<?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>Methods in JavaScript Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/methods-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/methods-in-javascript/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:30:47 +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>How to use Number Methods in JavaScript?</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-use-number-methods-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-use-number-methods-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Thu, 05 Aug 2021 11:38:40 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Methods in JavaScript]]></category>
		<category><![CDATA[toString( )]]></category>
		<category><![CDATA[Variable]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7442</guid>

					<description><![CDATA[<p>Number Methods toString ( ) toExponential ( ) toFixed ( ) toPrecision ( ) valueOf( ) isFinite( ) isInteger( ) [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-use-number-methods-in-javascript/">How to use Number Methods in JavaScript?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Number Methods</h2>



<ul class="wp-block-list"><li><strong>toString ( )</strong></li><li><strong>toExponential ( )</strong></li><li><strong>toFixed ( )</strong></li><li><strong>toPrecision ( )</strong></li><li><strong>valueOf( )</strong></li><li><strong>isFinite( )</strong></li><li><strong>isInteger( )</strong></li><li><strong>isNan( )</strong></li><li><strong>isSafeInteger( )</strong></li></ul>



<h2 class="wp-block-heading">toString( )</h2>



<p class="wp-block-paragraph">toString ( ) method returns a number as a string in other words it converts a number into a string. We can use this method to output numbers as hexadecimal (16), octal(8), binary(2).</p>



<p class="wp-block-paragraph"><strong>Syntax: &#8211;<br>Variable_name.toString( );</strong></p>



<script src="https://gist.github.com/vijaypk376/f1fc0a684e12220197b9ce3abcc7cc69.js"></script>



<h2 class="wp-block-heading">toExponential ( )</h2>



<p class="wp-block-paragraph">The toExponential() method converts a number into an exponential notation.</p>



<p class="wp-block-paragraph">Syntax:-<br>Variable_name.toExponential(y)<br>Where y is an integer between 0 and 20 representing the number of digits in the<br>notation after the decimal point. If omitted, it is set to as many digits as necessary to<br>represent the value.</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong></p>



<script src="https://gist.github.com/vijaypk376/690db0ff3ba7194c2770fd51dfd354eb.js"></script>



<h2 class="wp-block-heading">toFixed ( )</h2>



<p class="wp-block-paragraph">The toFixed() method converts a number into a string, keeping a specified number of decimals also rounds the decimal. If the desired number of decimals is higher than the actual number, nulls are added to create the desired decimal length.</p>



<p class="wp-block-paragraph">Syntax: &#8211;<br>a.toFixed(y)<br>Where y is the number of digits after the decimal point. Default is 0 (no digits after the decimal point)</p>



<p class="wp-block-paragraph">Syntax: &#8211;<br>a.toFixed(y)<br>Where y is the number of digits after the decimal point. Default is 0 (no digits after the decimal point)</p>



<p class="wp-block-paragraph">Ex:-</p>



<script src="https://gist.github.com/vijaypk376/75571b15d69e97a04ddbf28799af5dae.js"></script>



<h2 class="wp-block-heading">toPrecision ( )</h2>



<p class="wp-block-paragraph">The toPrecision() method formats a number to a specified length.<br>A decimal point and nulls are added (if needed), to create the specified length.</p>



<p class="wp-block-paragraph">Syntax:-<br>Variable_name.toPrecision(y)<br>Where y is the number of digits. If omitted, it returns the entire number (without any<br>formatting)</p>



<p class="wp-block-paragraph">Syntax:-<br>Variable_name.toPrecision(y)<br>Where y is the number of digits. If omitted, it returns the entire number (without any<br>formatting)</p>



<p class="wp-block-paragraph">Ex:-</p>



<script src="https://gist.github.com/vijaypk376/e35753fc561a64f68f1d93ab8b86e882.js"></script>



<h2 class="wp-block-heading">Number.isNaN()</h2>



<p class="wp-block-paragraph">The <strong>Number.isNaN() </strong>method determines whether a value is NaN (Not-A-Number).<br>This method returns true if the value is of the type Number, and equates to NaN. Otherwise, it returns false.<br>Number.isNaN() is different from the global isNaN() function. The global isNaN() function<br>converts the tested value to a Number, then tests it.<br>Number.isNaN() does not convert the values to a Number, and will not return true for any value<br>that is not of the type Number.</p>



<script src="https://gist.github.com/vijaypk376/16f8fc3f9eba2e7e18df23951e82f852.js"></script>



<h2 class="wp-block-heading">Number.isInteger( )</h2>



<p class="wp-block-paragraph">The Number.isInteger() method determines whether a value is an integer.<br>This method returns true if the value is of the type Number, and an integer, otherwise it<br>returns false.</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;</strong></p>



<script src="https://gist.github.com/vijaypk376/ad493b00cbc323e47e0f38adf4143e5d.js"></script>



<h2 class="wp-block-heading">Number.isSafeInteger()</h2>



<p class="wp-block-paragraph">The Number.isSafeInteger() method determines whether a value is a safe integer.<br>A safe integer is an integer that can be exactly all integers from (2^53 &#8211; 1) to -(2^53 &#8211; 1)<br>This method returns true if the value is of the type Number and a safe integer.<br>Otherwise, it returns false.</p>



<script src="https://gist.github.com/vijaypk376/f3532004826a3db95488ecdd8eab380c.js"></script>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-use-number-methods-in-javascript/">How to use Number 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/how-to-use-number-methods-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Private Properties and Methods in JavaScript</title>
		<link>https://www.scmgalaxy.com/tutorials/private-properties-and-methods-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/private-properties-and-methods-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Wed, 04 Aug 2021 10:07:34 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Methods in JavaScript]]></category>
		<category><![CDATA[Private Properties]]></category>
		<category><![CDATA[Prototype Object]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7358</guid>

					<description><![CDATA[<p>Private Properties and Methods Using var or let or const you can create private properties and methods. Ex: &#8211;this.pricevar pricelet [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/private-properties-and-methods-in-javascript/">Private Properties and Methods in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Private Properties and Methods</h2>



<p class="wp-block-paragraph">Using var or let or const you can create private properties and methods.</p>



<p class="wp-block-paragraph"><strong>Ex: &#8211;<br>this.price<br>var price<br>let price</strong></p>



<h2 class="wp-block-heading">Prototype</h2>



<p class="wp-block-paragraph">Every object has an internal prototype that gives it its structure. This internal prototype is a reference to an object describing the code and data that all objects of that same type will have in common.</p>



<h2 class="wp-block-heading">Prototype Object</h2>



<p class="wp-block-paragraph">Every object is associated with another Object in JavaScript</p>



<script src="https://gist.github.com/vijaypk376/f1122b4bceaa6288caa7819ad39da063.js"></script>



<h2 class="wp-block-heading">Prototype Object</h2>



<p class="wp-block-paragraph">Every object is associated with another object in JavaScript.</p>



<script src="https://gist.github.com/vijaypk376/b75a4166de20a23e117da7c753f1498f.js"></script>



<p class="wp-block-paragraph">Note &#8211; Prototype Object of Object.prototype is null</p>



<h2 class="wp-block-heading">Prototype Object</h2>



<p class="wp-block-paragraph">Every object is associated with another object in JavaScript.</p>



<script src="https://gist.github.com/vijaypk376/135c9f5b995aacba15acd7246656d951.js"></script>



<p class="wp-block-paragraph">Note &#8211; Prototype Object of Object.prototype is null</p>



<h2 class="wp-block-heading">Prototype Object</h2>



<p class="wp-block-paragraph">Every object is associated with another object in JavaScript.</p>



<script src="https://gist.github.com/vijaypk376/f11c7e8a559d07f217349b7b4b9e9222.js"></script>



<p class="wp-block-paragraph">Note &#8211; Prototype Object of Array.prototype is Object.prototype and<br>           Prototype Object of Object.prototype is null</p>



<h2 class="wp-block-heading">Prototype Object</h2>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="614" height="319" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.png" alt="" class="wp-image-7361" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.png 614w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-300x156.png 300w" sizes="(max-width: 614px) 100vw, 614px" /></figure>



<script src="https://gist.github.com/vijaypk376/152b0aae506e4bc46d6ae966e820e1cd.js"></script>



<figure class="wp-block-image size-large"><img decoding="async" width="942" height="521" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile.png" alt="" class="wp-image-7364" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile.png 942w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-300x166.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-768x425.png 768w" sizes="(max-width: 942px) 100vw, 942px" /></figure>



<script src="https://gist.github.com/vijaypk376/bf959f46d0492dcb19332e0578ac3b8f.js"></script>



<figure class="wp-block-image size-large"><img decoding="async" width="927" height="401" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-2.png" alt="" class="wp-image-7367" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-2.png 927w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-2-300x130.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-2-768x332.png 768w" sizes="(max-width: 927px) 100vw, 927px" /></figure>



<script src="https://gist.github.com/vijaypk376/55b34fe00e9b805884095d6e4311b024.js"></script>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="730" height="360" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-3.png" alt="" class="wp-image-7368" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-3.png 730w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-3-300x148.png 300w" sizes="auto, (max-width: 730px) 100vw, 730px" /></figure>



<script src="https://gist.github.com/vijaypk376/37e7dafd1fd45001afaadccf31ca7b44.js"></script>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="858" height="404" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-4.png" alt="" class="wp-image-7369" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-4.png 858w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-4-300x141.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-4-768x362.png 768w" sizes="auto, (max-width: 858px) 100vw, 858px" /></figure>



<script src="https://gist.github.com/vijaypk376/32a3117d1e37046296194c35f147911f.js"></script>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="726" height="393" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-5.png" alt="" class="wp-image-7370" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-5.png 726w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object-function-mobile-5-300x162.png 300w" sizes="auto, (max-width: 726px) 100vw, 726px" /></figure>



<script src="https://gist.github.com/vijaypk376/b5ae44b236d3662e508579be5b911f30.js"></script>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="940" height="507" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype.png" alt="" class="wp-image-7371" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype.png 940w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-300x162.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-768x414.png 768w" sizes="auto, (max-width: 940px) 100vw, 940px" /></figure>



<script src="https://gist.github.com/vijaypk376/9ab47c9d25b29b3535a273f8548be934.js"></script>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="941" height="514" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-1.png" alt="" class="wp-image-7372" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-1.png 941w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-1-300x164.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/pototype-object.prototype-1-768x420.png 768w" sizes="auto, (max-width: 941px) 100vw, 941px" /></figure>



<script src="https://gist.github.com/vijaypk376/5c8779baae355ffb1e02411c994759fa.js"></script>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/private-properties-and-methods-in-javascript/">Private Properties and 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/private-properties-and-methods-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>
