<?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>JS &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/category/js/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>React ES6</title>
		<link>https://www.maxester.com/blog/2023/12/05/react-es6/</link>
		<comments>https://www.maxester.com/blog/2023/12/05/react-es6/#respond</comments>
		<pubDate>Tue, 05 Dec 2023 07:30:43 +0000</pubDate>
		<dc:creator><![CDATA[Mayank Jha]]></dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[React Js]]></category>
		<category><![CDATA[ES6]]></category>
		<category><![CDATA[ES6 vs ES5]]></category>
		<category><![CDATA[React ES6]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1134</guid>
		<description><![CDATA[<p>ES6 ES6 stands for ECMAScript6. ES6 was released in 2015 and is also known as the ECMAScript 2015. It is basically a standard, which the scripting languages have to follow. As we know, Javascript is a scripting language. JS also&#8230;</p>
<p><a href="https://www.maxester.com/blog/2023/12/05/react-es6/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2023/12/05/react-es6/">React ES6</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<h3>ES6</h3>



<p>ES6 stands for ECMAScript6. ES6 was released in 2015 and is also known as the ECMAScript 2015. It is basically a standard, which the scripting languages have to follow.</p>



<p>As we know, Javascript is a scripting language. JS also follows ES6 standards. ES6 helps to standardize JS. After ES6, JS got many new features like let keyword, Arrow functions, Rest and Spread Operators, Classes, Array and object destructuring, default parameters and the list goes on. These newly introduced features are very much useful to minimize the no. of lines of code.</p>



<h3>React ES6</h3>



<p>React Js is a Javascript library, which is used for creating single page applications. The reason for React Js&#8217;s popularity is its features like code reusability, single page application.</p>



<p>React ES6 is the combination of React and ES6 standards. React Js was first inroduced in year 2013. Since then it got many features, one of which is the adoption of ES6 syntax. ES6 syntax makes the code more precise and concise. For example, Use of Arrow functions instead of regular functions.</p>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://www.maxester.com/blog/wp-content/uploads/2023/12/Screenshot-21-1.png" alt="" class="wp-image-1136"/></figure></div>



<p>In the above example both the function performs the same addition operation, but sum2 (Arrow function) is a more cleaner way to write the code.</p>



<h3>Features of React ES6</h3>



<p>React ES6 includes many new features, which are listed below :-</p>



<ul><li>Classes and objects</li><li>Rest and spread operators</li><li>Array and object destructuring</li><li>let and const keyword</li><li>Array methods like .map(), .filter() and .reduce()</li></ul>



<h3>Difference between ES6 and ES5</h3>



<div class="wp-block-columns has-2-columns">
<div class="wp-block-column">
<h4>ES5</h4>



<ol><li>It was the 5th version of the ECMAScript.</li><li>ES5 is more older, hence it has more community support.</li><li>Code writing in ES5, was more time consuming.</li><li>There was always risk of changing constant values by mistake, as there was no const keyword.</li><li>ES5 also had the problem of variable conflicts, because a variable declared using the var keyword is global and change it&#8217;s value inside any other block results in change of the global variable.</li><li>There was only simple for loop.</li></ol>
</div>



<div class="wp-block-column">
<h4>ES6</h4>



<ol><li>It is the latest and 6th addition of the ECMAScript.</li><li>It has community support, but less than the ES5.</li><li>It makes the code more concise with features like destructuring and spread operators.</li><li>Constant values can be declared using the keyword const.</li><li>Variables can be declared using let keyword to avoid the scope related problems.</li><li>ES6 has the for of loop, which can be used to iterate over the objects, more efficiently.</li></ol>
</div>
</div>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2023/12/05/react-es6/">React ES6</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2023/12/05/react-es6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parallel ajax request using Jquery</title>
		<link>https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/</link>
		<comments>https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/#respond</comments>
		<pubDate>Fri, 11 Sep 2020 19:52:42 +0000</pubDate>
		<dc:creator><![CDATA[Maxester]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=815</guid>
		<description><![CDATA[<p>Let us assume we need to hit a lot of URLs to append data to a page this so to reduce the time we need to make these requests simultaneous. The below code contains an array of JSON values these&#8230;</p>
<p><a href="https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/">Parallel ajax request using Jquery</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Let us assume we need to hit a lot of URLs to append data to a page this so to reduce the time we need to make these requests simultaneous.</p>



<p>The below code  contains an array of JSON values </p>



<p>these JSON values are URL and respective id</p>



<p>URL is tho fetch data and ID is to append data</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<pre class="wp-block-code"><code>    s = [{
		url : "url1",
		id : "id1"
	},{
		url : "url2",
		id : "id2"
	},{
		url : "url3",
		id : "id3"
	},{
		url : "url4",
		id : "id4"
	}]</code></pre>



<p>now calling all these URL in .each()</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<pre class="wp-block-code"><code>

$(s).each(function() {
	var url = this.url, id = this.id;
	$.getJSON(url, {id: id }).done( function(data) {
		$(data.id).append(data.value)
	});
})</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/">Parallel ajax request using Jquery</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2020/09/11/parallel-ajax-request-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Capitalize First Letter Of Each Word In Js ?</title>
		<link>https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/</link>
		<comments>https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/#respond</comments>
		<pubDate>Thu, 21 Nov 2019 15:25:28 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=741</guid>
		<description><![CDATA[<p>By using function: &#8220;replace()&#8221; is a iterative function calling a regex as first parameter and adding callback function as its second parameter we can achieve this. Regular Expression for Every Word in a String ( /\w\S*/g ) And Callback function&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/">How To Capitalize First Letter Of Each Word In Js ?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>By using function:</p>



<p>&#8220;replace()&#8221; is a iterative function calling a regex as first parameter and  adding callback function as its second parameter we can achieve this.</p>



<p>Regular Expression for Every Word in a String ( /\w\S*/g )</p>



<p>And</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>Callback function converts first word of every word to Upper case</p>



<pre class="wp-block-code"><code>var text = "how to capitalize first letter of each word in js ?";

function toTitleCase(str) {
    return str.replace(/\w\S*/g, function(txt){
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    });
}

text = toTitleCase(text);

//output
//How To Capitalize First Letter Of Each Word In Js ?</code></pre>



<p>For es6:</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>var text = "how to capitalize first letter of each word in js ?";

upperCaseWords = (s => s.toLowerCase().split(" ").map(s => s.charAt(0).toUpperCase() + s.substring(1)).join(" "));
    
text = upperCaseWords(text)

//output
//How To Capitalize First Letter Of Each Word In Js ?</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/">How To Capitalize First Letter Of Each Word In Js ?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic web form validation with predefined rules and messages</title>
		<link>https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/</link>
		<comments>https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/#respond</comments>
		<pubDate>Sat, 16 Nov 2019 13:45:17 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=735</guid>
		<description><![CDATA[<p>Sometimes when we are using same validation rules for a form in different location with different ID&#8217;s. To prevent repeating the code and make it more maintainable we define it as a function in one place. That is what this&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/">Dynamic web form validation with predefined rules and messages</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Sometimes when we are using same validation rules for a form in different location with different ID&#8217;s.</p>



<p>To prevent repeating the code and make it more maintainable we define it as a function in one place.</p>



<p>That is what this blog is about.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p> <strong>Prerequisite </strong></p>



<ul><li> <strong>jQuery</strong> </li><li> <strong>jQuery Validation Plugin</strong> </li></ul>



<p>

Create a js file

</p>



<pre class="wp-block-code"><code>var $postJobValidation = {
	id: function(e) {
		$("#" + e).validate({
			rules: this.rules,
			messages: this.messages
		})
	},
	set: function(e) {

		if (e) {
			for (t in e) {

				if (e[t].rule)
					this.rules[t] = e[t].rule

				if (e[t].message)
					this.messages[t] = e[t].message
			}
		}
	},
	rules: {
		name: "required",
		email: {
			email: !0,
			required: !0
		},
	},
	messages: {
		name: "PLease Enter Your Name",
		email: {
			email: "Enter Valid Email!",
			required: "Enter Email!"
		},
	}
};</code></pre>



<p>To validate a form with id &#8220;<strong>form1</strong>&#8221; and having fiels name and email.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$formValidation.id("form1")</code></pre>



<p>To add rules and message we just need to edit <strong>rules </strong>and <strong>message </strong>object in <strong>$formValidation</strong></p>



<pre class="wp-block-code"><code>$postJobValidation.set({
	"contact": {
		rule: "required",
		message: "Please Enter Your Contact"
	}
})</code></pre>



<p>Set function iterates through the json provided and adding  rules</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/">Dynamic web form validation with predefined rules and messages</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Json parsing to add an  iterating element by Jquery</title>
		<link>https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/</link>
		<comments>https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/#respond</comments>
		<pubDate>Mon, 04 Nov 2019 09:34:21 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=715</guid>
		<description><![CDATA[<p>To reduce load time and improve user experience we use ajax to get add new element to existing html. let the response be: let the response is saved in var response let the place where response is appended is to&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/">Json parsing to add an  iterating element by Jquery</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>To reduce load time and improve user experience we use ajax to get add new element to existing html.</p>



<p>let the response be:</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>[{
    "data1": "male",
    "data2": "23",
    "data3": "Delhi",
    "data4": "10+2 or above"
}, {
    "data1": "male",
    "data2": "40",
    "data3": "Delhi",
    "data4": "Diploma"
}, {
    "data1": "male",
    "data2": "31",
    "data3": "Delhi",
    "data4": "Graduation"
}, {
    "data1": "male",
    "data2": "25",
    "data3": "Delhi",
    "data4": "Post Graduation"
}]</code></pre>



<p style="text-align:left">let the response is saved in <strong>var  response </strong></p>



<p>let the place where response is appended is </p>



<pre class="wp-block-code"><code>&lt;div>&lt;table id="append">&lt;/table>&lt;/div></code></pre>



<p>to append the json store in data to &#8220;#append&#8221;</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$("#append").append(response.map(data => `&lt;tr>&lt;td>${data.data1}&lt;/td>&lt;td>${data.data2}&lt;/td>&lt;td>${data.data3}&lt;/td>&lt;td>${data.data4}&lt;/td>&lt;/tr>`))</code></pre>



<p>Jquery append function is an iterative function which will call <strong>response.map</strong> which will call parse json</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/">Json parsing to add an  iterating element by Jquery</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node Event Module</title>
		<link>https://www.maxester.com/blog/2019/10/22/node-event-module/</link>
		<comments>https://www.maxester.com/blog/2019/10/22/node-event-module/#respond</comments>
		<pubDate>Tue, 22 Oct 2019 01:21:39 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[Node Js]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=707</guid>
		<description><![CDATA[<p>Node has a concept of event-driven programming, in which code is written to react rather than be called. Node has an inbuilt event module about which you learn in-depth from here, we will use event listener and event emitter method&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/10/22/node-event-module/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/node-event-module/">Node Event Module</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Node has a concept of event-driven programming, in which code is written to <strong>react</strong> rather than be <strong>called</strong>. </p>



<p>Node has an inbuilt event module about which you learn in-depth from <a href="https://nodejs.org/api/events.html">here</a>, we will use event listener and event emitter method of this class.</p>



<pre class="wp-block-code"><code>const EventEmitter = require('events');

const event = new EventEmitter();</code></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p><strong>Event Listener</strong></p>



<p>An event listener is a logic which will be executed when an event is emitted. Make sure you have declared Event listener before emitting the event.</p>



<pre class="wp-block-code"><code>event.on('some-event', function() {
  // some logic
});


//es6
event.on('some-event', () => {
  // some logic
});


//with parameter
event.on('some-event', (parameter) => {
  // some logic
});</code></pre>



<p><strong>Event Emitter</strong></p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>Event emitter is used to trigger a specific event listener.</p>



<pre class="wp-block-code"><code>
event.emit('some-event', parameter);</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/node-event-module/">Node Event Module</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/10/22/node-event-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Js Filter And Sort</title>
		<link>https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/</link>
		<comments>https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/#respond</comments>
		<pubDate>Mon, 14 Oct 2019 11:38:21 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=700</guid>
		<description><![CDATA[<p>Filter &#8211; High order function used to filter any array with the help of the callback function it uses same argument as map only difference is the return type is either true or false. It return type is true value&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/">Js Filter And Sort</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p><strong>Filter</strong> &#8211;  High order function used to filter any array with the help of the callback function it uses same argument as map only difference is the return type is either true or false.</p>



<p>It return type is <strong>true </strong>value is kept in the array if <strong>false </strong>value is removed.</p>



<p>Lets have an example to understand its implementation.</p>



<pre class="wp-block-code"><code>let arr1 = [6, 1, 3, 2, 8, 1, 7, 5, 9 ,9];</code></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>As you can see arr1 is an array with values 1-9 with non unique values.</p>



<p>to get values greater than 4</p>



<pre class="wp-block-code"><code>a.filter(x => x>4)
// output [6, 8, 7, 5, 9, 9]</code></pre>



<p></p>



<p><strong>Sort</strong> &#8211;  High order function used to sort values in <strong>asc </strong>or <strong>desc </strong>order.</p>



<p> Lets have an example to understand its implementation. </p>



<pre class="wp-block-code"><code>let arr2 = [6, 1, 3, 2, 8, 1, 7, 5, 9 ,9];</code></pre>



<p> As you can see arr2 is an array with values 1-9 with non unique values. </p>



<p>to get values in <strong>asc </strong>order</p>



<pre class="wp-block-code"><code>arr2 = arr2.sort()
//output [1, 1, 2, 3, 5, 6, 7, 8, 9, 9]</code></pre>



<p> to get values in <strong>desc </strong>order </p>



<pre class="wp-block-code"><code>arr2 = arr2.sort( (a, b) => b - a );
//output [9, 9, 8, 7, 6, 5, 3, 2, 1, 1]</code></pre>



<p><strong>for string</strong></p>



<p>

to get values in <strong>asc </strong>order

</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>let arr3 = ['a', 'b', '25', '100'];
arr3 = arr3.sort( (a, b) => a &lt; b ? -1 : 1 );
// output ["100", "25", "a", "b"]</code></pre>



<p>as you can see 100 is shown smaller than 25 as sort compares 1 to 2 and 1 is clearly smaller than 2 and rest are arranged in alphabetical order as in a  Dictionary </p>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/">Js Filter And Sort</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/10/14/js-filter-and-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Short-Circuit Evaluation in JS?</title>
		<link>https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/</link>
		<comments>https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/#respond</comments>
		<pubDate>Mon, 16 Sep 2019 14:27:07 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=649</guid>
		<description><![CDATA[<p>Logical operators (&#38;&#38;, &#124;&#124;, &#38;, &#124;) are used to reduce the complexity which can be used concisely. ANDoperator (&#38;&#38;) returns first false for false value and last true for true values. But, OR operator (&#124;&#124;) returns first true for truely&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/">What is Short-Circuit Evaluation in JS?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Logical operators (&amp;&amp;, ||, &amp;, |) are used to reduce the complexity which can be used concisely.</p>



<p>ANDoperator (<strong>&amp;&amp;</strong>) returns first false for false value and last true for true values.</p>



<p>But,</p>



<p>OR operator (<strong>||</strong>) returns first true for truely statement and last false for false statement.</p>



<p>So, for</p>



<p><strong>Falsely statement</strong></p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>console.log( 0 || [] );
//returns [] as it is last false 

console.log( 0 || [] );
//returns 0 as it is first false </code></pre>



<p><strong>Truely statement</strong></p>



<pre class="wp-block-code"><code>console.log( 1 || 0 || 3 );
//returns 1 as it is first true 

console.log( 1 || 2 || 3 );
//returns 0 as it is last true</code></pre>



<p><strong>NOTE:- In JS all values are true except ( 0, &#8220;&#8221;, undefined, null and false)</strong></p>



<p><strong>Bitwise operators</strong> like( <strong>|, &amp;</strong> )</p>



<p>bit wise operators use to perform binary operations like bitwise or ( binay add ) and bitwise and ( binary multiplication )</p>



<p>so,</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>console.log( 3 | 2 )
// returns 3 as binary sum of 011 and 010 is 011

console.log( 3 &amp; 2 )
// returns 2 as binary sum of 011 and 010 is 010
</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/">What is Short-Circuit Evaluation in JS?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/09/16/what-is-short-circuit-evaluation-in-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Require Function Parameter in JS?</title>
		<link>https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/</link>
		<comments>https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/#respond</comments>
		<pubDate>Wed, 11 Sep 2019 07:28:19 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=646</guid>
		<description><![CDATA[<p>In es6 default parameter were added which is a welcome change, but what if you want to throw error if a parameter was not provided. Well you can do it by calling a closure in default parameter which can throw&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/">How to Require Function Parameter in JS?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>In es6 default parameter were added which is a welcome change, but what if you want to throw error if a parameter was not provided.</p>



<p>Well you can do it by calling a closure in default parameter which can throw error for you.</p>



<p>This practice is good if you are having a lot of function with required parameters to debug what went wrong quickly. Otherwise it you can simply show an error from inside the function</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>const isRequired = (message = null) => {
 let err = (message == null || message.length &lt; 2) ? 'param is required' : `${message[0]} param is required in ${message[1]} function`;
 throw new Error();
};

const myFunction = (param1 = isRequired(['name', 'myFunction'])) => {
 console.log(`param: ${param1}`)
};

// These will throw an error
myFunction();
myFunction(undefined);

// These are work!
myFunction(null);
myFunction('Maxester');</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/">How to Require Function Parameter in JS?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/09/11/how-to-require-function-parameter-in-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Form Validation And Ajax submission using Jquery Validation</title>
		<link>https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/</link>
		<comments>https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/#respond</comments>
		<pubDate>Mon, 15 Jul 2019 17:14:06 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=580</guid>
		<description><![CDATA[<p>Jquery has a validation plugin which requires &#8220;rules:&#8221; and &#8220;messages:&#8221;. Rules are the validation case that you want to check on an input field. And, Messages are the response to those input field which violates the rules. Jquery validation uses&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/">Form Validation And Ajax submission using Jquery Validation</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Jquery has a validation plugin which requires <strong>&#8220;rules:&#8221; </strong>and <strong>&#8220;messages:&#8221;</strong>.</p>



<p><strong>Rules </strong>are the validation case that you want to check on an input field.</p>



<p>And, <strong>Messages </strong>are the response to those input field which violates the rules.</p>



<p>Jquery validation uses name instead of id for validation.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$("#form_id").validate({
rules:{
	name:"required",
	email:{email: true,required: true},
	mobile:{required : true,minlength:10},

},

messages: {
	name:"Please fill name",
	email:{email:"Enter Valid Email!",
		required:"Enter Email!"
		},
	mobile:{minlength:"Please enter Valid Mobile No.",
		required:"Please enter Mobile No."
		},
},

submitHandler: function(form){
$.ajax({
	url: form.action,
	type: form.method,
	data: $(form).serialize(),
	success: function(response) {
		$('#answers').html(response);
	}            
      });		
}
});</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/">Form Validation And Ajax submission using Jquery Validation</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/07/15/form-validation-and-ajax-submission-using-jquery-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
