<?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>Pro-Tek Blog &#187; JavaScript ES6</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/tag/javascript-es6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>JAVASCRIPT ES6</title>
		<link>http://www.pro-tekconsulting.com/blog/javascript-es6/</link>
		<comments>http://www.pro-tekconsulting.com/blog/javascript-es6/#comments</comments>
		<pubDate>Tue, 30 Oct 2018 07:03:34 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JavaScript ES6]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2708</guid>
		<description><![CDATA[<p>JavaScript ES6 JavaScript ES6 brings new syntax and amazing features to make the users code more up-to-date and readable. It allows the user to write less code and do more. ES6 introduces the user to many great features like arrow functions, template strings, class destruction, Modules, and much more. So, let’s dive deep in and [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/javascript-es6/">JAVASCRIPT ES6</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>JavaScript ES6</h4>
<p>JavaScript ES6 brings new syntax and amazing features to make the users code more up-to-date and readable. It allows the user to write less code and do more. ES6 introduces the user to many great features like arrow functions, template strings, class destruction, Modules, and much more. So, let’s dive deep in and study the new features on JavaScript ES6.</p>
<p><strong>CONST &amp; LET</strong></p>
<p>Const is a new keyword in ES6 for declaring variables. const is more influential than var. Once it is used, the variable cannot be reassigned. In other words, it is an immutable variable except when it used with objects. This is really useful for targeting the selectors.</p>
<p>const a = 50;<br />
a = 60; // shows error. You cannot change the value of const.<br />
const b = &#8220;Constant variable&#8221;;<br />
b = &#8220;Assigning new value&#8221;; // shows error.</p>
<p><strong>LET</strong></p>
<p>Let is similar to var but let has scope. Let is only accessible in the block level it is defined.</p>
<p><img class="aligncenter size-medium wp-image-2712" src="http://www.pro-tekconsulting.com/blog/wp-content/uploads/2018/10/JavaScript-ES6-300x247.jpg" alt="JavaScript ES6" width="300" height="247" /><br />
if (true) {<br />
let a = 40;<br />
console.log(a); //40<br />
}<br />
console.log(a); // undefined<br />
In the above example variable ‘a’ is defined inside If statement and so it’s not accessible outside the function.</p>
<p><strong>ARROW FUNCTIONS</strong></p>
<p>The arrow function makes the users code more readable, more structured, and look like modern code.</p>
<p>// Old Syntax<br />
function oldOne() {<br />
console.log(&#8220;Hello World..!&#8221;);<br />
}<br />
// New Syntax<br />
var newOne = () =&gt; {<br />
console.log(&#8220;Hello World..!&#8221;);<br />
}<br />
The new syntax may be confusing a bit.<br />
There are two parts of the syntax.<br />
var newOne = ()<br />
=&gt; {}</p>
<p>The first part is declaring a variable and assigning the function () to it.<br />
The second part is declaring the body part of the function. The arrow part with the curly braces defines the body part.</p>
<p><strong>DEFAULT PARAMETERS</strong></p>
<p>If you are familiar with other programming languages such as Ruby, Python then default parameters is not new to you.</p>
<p>Default parameters are parameters which are given by default while declaring a function. But the value can be changed when calling the function.</p>
<p>let Func = (a, b = 10) =&gt; {<br />
return a + b;<br />
}<br />
Func(20); // 20 + 10 = 30</p>
<p>In the above example, we are passing only one parameter. The function makes use of the default parameter and executes the function.</p>
<p><strong>MAPS</strong></p>
<p>Map holds key-value pairs, it is similar to an array but we can define our own index and indexes are unique in maps. In maps, all indexes are unique and we can use any value as key or value.</p>
<p>var NewMap = new Map();<br />
NewMap.set(&#8216;name&#8217;, &#8216;John&#8217;);<br />
NewMap.set(&#8216;id&#8217;, 2345796);<br />
NewMap.set(&#8216;interest&#8217;, [&#8216;js&#8217;, &#8216;ruby&#8217;, &#8216;python&#8217;]);<br />
NewMap.get(&#8216;name&#8217;); // John<br />
NewMap.get(&#8216;id&#8217;); // 2345796<br />
NewMap.get(&#8216;interest&#8217;); // [&#8216;js&#8217;, &#8216;ruby&#8217;, &#8216;python&#8217;]</p>
<p><strong>GETTERS AND SETTERS</strong></p>
<p>Getters and setters are one of the useful feature introduced in ES6. It will come in handy if you are using classes in JS.</p>
<p>class People {<br />
constructor(name) {<br />
this.name = name;<br />
}<br />
getName() {<br />
return this.name;<br />
}<br />
setName(name) {<br />
this.name = name;<br />
}<br />
}<br />
let person = new People(&#8220;Jon Snow&#8221;);<br />
console.log(person.getName());<br />
person.setName(&#8220;Dany&#8221;);<br />
console.log(person.getName());<br />
Output:<br />
Jon Snow<br />
Dany</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/javascript-es6/">JAVASCRIPT ES6</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/javascript-es6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WHAT ARE THE PROS AND CONS OF USING JAVASCRIPT ES5 VERSUS ES6?</title>
		<link>http://www.pro-tekconsulting.com/blog/what-are-the-pros-and-cons-of-using-javascript-es5-versus-es6/</link>
		<comments>http://www.pro-tekconsulting.com/blog/what-are-the-pros-and-cons-of-using-javascript-es5-versus-es6/#comments</comments>
		<pubDate>Wed, 12 Sep 2018 06:40:19 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JavaScript ES5]]></category>
		<category><![CDATA[JavaScript ES6]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2642</guid>
		<description><![CDATA[<p>What are the pros and cons of using JavaScript ES5 versus ES6? Pros ES5: You have a lot of browser support. ES6: You have tail call optimization. You have import statements. Lamba&#8217;s are pretty amazing. Immutable and block scoping objects with &#8220;const&#8221; and &#8220;let&#8221;. Classes and OO Inheritance. Functors, and all that functional goodness. String [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/what-are-the-pros-and-cons-of-using-javascript-es5-versus-es6/">WHAT ARE THE PROS AND CONS OF USING JAVASCRIPT ES5 VERSUS ES6?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>What are the pros and cons of using JavaScript ES5 versus ES6?</h4>
<p><strong>Pros</strong></p>
<p>ES5:</p>
<p>You have a lot of browser support.</p>
<p>ES6:</p>
<p>You have tail call optimization.<br />
You have import statements.<br />
Lamba&#8217;s are pretty amazing.<br />
Immutable and block scoping objects with &#8220;const&#8221; and &#8220;let&#8221;.<br />
Classes and OO Inheritance.<br />
Functors, and all that functional goodness.<br />
String templates that handle interpolation for you.</p>
<p><strong>Cons</strong></p>
<p>ES5:</p>
<p>It doesn&#8217;t have everything that ES6 has.</p>
<p>ES6:</p>
<p>It doesn&#8217;t have all the support that ES5 has, but you can always transpile your ES6 code.</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/what-are-the-pros-and-cons-of-using-javascript-es5-versus-es6/">WHAT ARE THE PROS AND CONS OF USING JAVASCRIPT ES5 VERSUS ES6?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/what-are-the-pros-and-cons-of-using-javascript-es5-versus-es6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
