<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>userdefined method in javascript Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/userdefined-method-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/userdefined-method-in-javascript/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Fri, 26 Mar 2021 05:49:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Methods in JavaScript</title>
		<link>https://www.scmgalaxy.com/tutorials/methods-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/methods-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[abhishek k]]></dc:creator>
		<pubDate>Fri, 26 Mar 2021 05:49:54 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[javascript methods]]></category>
		<category><![CDATA[Methods in JavaScript]]></category>
		<category><![CDATA[predefined methods in javascript]]></category>
		<category><![CDATA[user defined and predefined method]]></category>
		<category><![CDATA[userdefined and predefined methods in javascript]]></category>
		<category><![CDATA[userdefined method]]></category>
		<category><![CDATA[userdefined method in javascript]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5768</guid>

					<description><![CDATA[<p>In JavaScript, however, a method is a function that belongs to an object. A JavaScript method is a property containing a function definition. Few Important things of Methods:- [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/methods-in-javascript/">Methods in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In JavaScript, however, a <em>method</em> is a <strong>function</strong> that belongs to an <strong><em>object</em></strong>. A JavaScript <strong>method</strong> is a property containing a <strong>function definition</strong>.</p>



<p class="wp-block-paragraph"><strong>Few Important things of Methods:-</strong></p>



<ul class="wp-block-list"><li>In JavaScript, however, a <strong><em>method</em> </strong>is a <em>function </em>that belongs to an <strong><em>object</em></strong>.</li><li>JavaScript <strong>methods </strong>are the actions that can be performed on <strong><em>objects</em></strong>.</li><li>A JavaScript <strong>method</strong> is a property containing a <em>function definition</em>.</li><li>Accessing the object method is done with the following syntax: <em>objectName.methodName()</em></li></ul>



<p class="wp-block-paragraph">Just similar to the <strong>functions</strong> in JavaScript methods are also classified in two categories:- </p>



<ol class="wp-block-list"><li>Predefined </li><li>User-defined</li></ol>



<p class="wp-block-paragraph">Predefined methods can be used directly by calling and giving parameter values (if required). while user-defined methods are first declared, defined, and then used in the program. </p>



<p class="wp-block-paragraph">Deceleration and definitions of User-defined methods are done together we could understand better seeing the below code.<strong><br>Syntax of Methods</strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
object = {
    methodName: function() {
        // Content
    }
};

object.methodName()
</pre></div>


<h2 class="has-medium-font-size wp-block-heading">How to access the Object Methods</h2>



<p class="wp-block-paragraph">we can access the object method with the following syntax stated below:- </p>



<p class="wp-block-paragraph"><em>objectName.methodName()</em></p>



<h2 class="has-medium-font-size wp-block-heading">How to add the method to Object.</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
person.name = function () {
    return this.firstName + &quot; &quot; + this.lastName;
};
</pre></div>


<p class="has-medium-font-size wp-block-paragraph"><strong>We could also directly use the built-in method.</strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
var message = &quot;Display message of your choice&quot;;
var x = message.toUpperCase();
</pre></div>


<p class="wp-block-paragraph">The above method would just convert the text entered as a message to uppercase. </p>



<p class="wp-block-paragraph"><strong>Few important links for learning:-</strong></p>



<ol class="wp-block-list"><li>Want to know the difference between <strong>Function </strong>and <strong>Method </strong>in JavaScript? Just click <a href="https://www.scmgalaxy.com/tutorials/difference-between-function-and-method-in-javascript/" target="_blank" rel="noreferrer noopener">here</a>.</li><li>Want to know what is <strong>function</strong> and how to use them in JavaScript? Just click <a rel="noreferrer noopener" href="https://www.scmgalaxy.com/tutorials/function-in-javascript/" target="_blank">here</a>.</li><li>Want to know what are <strong>variables </strong>and how to use them in JavaScript? Just click <a rel="noreferrer noopener" href="https://www.scmgalaxy.com/tutorials/variables-in-javascript-var-let-const/" target="_blank">here</a>.</li><li>Let’s see an example for <strong>User form validation</strong> in JavaScript. click <a rel="noreferrer noopener" href="https://www.scmgalaxy.com/tutorials/registration-form-validation-using-javascript/" target="_blank">here</a>.</li><li>Let’s<strong> understand JavaScript</strong>. what and how? click <a rel="noreferrer noopener" href="https://www.scmgalaxy.com/tutorials/a-brief-description-of-javascript/" target="_blank">here</a>.</li></ol>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/methods-in-javascript/">Methods in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/methods-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
