
<?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>Learn ES6 Archives - TECHNIG</title>
	<atom:link href="https://www.technig.com/tag/learn-es6/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.technig.com/tag/learn-es6/amp/</link>
	<description>Gateway for IT Experts and Tech Geeks</description>
	<lastBuildDate>Tue, 20 Oct 2020 23:22:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.technig.com/wp-content/uploads/2020/04/32x32.png</url>
	<title>Learn ES6 Archives - TECHNIG</title>
	<link>https://www.technig.com/tag/learn-es6/amp/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">162720667</site>	<item>
		<title>Learn ES6 : Basic Introduction and Configuration</title>
		<link>https://www.technig.com/learn-es6-basics-introduction/</link>
					<comments>https://www.technig.com/learn-es6-basics-introduction/#respond</comments>
		
		<dc:creator><![CDATA[Hujatulla Asghari]]></dc:creator>
		<pubDate>Sun, 26 Nov 2017 09:30:36 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ecmascript 6 Tutorial]]></category>
		<category><![CDATA[ES6 Tutorials]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript ES6 Tutorial]]></category>
		<category><![CDATA[JavaScript Framework]]></category>
		<category><![CDATA[JavaScript Tutorial]]></category>
		<category><![CDATA[Learn ES6]]></category>
		<category><![CDATA[Learn JavaScript]]></category>
		<category><![CDATA[learn javascript online]]></category>
		<category><![CDATA[learn javascript step by step]]></category>
		<guid isPermaLink="false">https://www.technig.com/?p=13942</guid>

					<description><![CDATA[<div style="margin-bottom:20px;"><img width="840" height="420" src="https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Learn ES6 Basics Introduction and Configuration - Technig" decoding="async" fetchpriority="high" srcset="https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig.jpg 840w, https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig-300x150.jpg 300w, https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig-768x384.jpg 768w" sizes="(max-width: 840px) 100vw, 840px" /></div>
<p>JavaScript is becoming more and more powerful every day. Nowadays, with JavaScript, you can develop almost any types of application. From desktop to web and even game and mobile apps. Also, you can applications that interact with a database with Nodejs. Besides, with new JavaScript Frameworks like Nuxtjs and Reduxjs you can develop amazing web [&#8230;]</p>
<p>The post <a href="https://www.technig.com/learn-es6-basics-introduction/">Learn ES6 : Basic Introduction and Configuration</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div style="margin-bottom:20px;"><img width="840" height="420" src="https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="Learn ES6 Basics Introduction and Configuration - Technig" decoding="async" srcset="https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig.jpg 840w, https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig-300x150.jpg 300w, https://www.technig.com/wp-content/uploads/2017/11/learn-es6-basics-introduction-and-configuration-technig-768x384.jpg 768w" sizes="(max-width: 840px) 100vw, 840px" /></div><p>JavaScript is becoming more and more powerful every day. Nowadays, with JavaScript, you can develop almost any types of application. From desktop to web and even game and mobile apps. Also, you can applications that interact with a database with Nodejs. Besides, with new JavaScript Frameworks like Nuxtjs and Reduxjs you can develop amazing web applications. In contrast, you must know to learn ES6 basics.</p>
<h2>What is ES6?</h2>
<p>ES6 or EcmaScript is the future of JavaScript. In a nutshell, JavaScript was taken from ECMAScript. Nowadays, people bring updates to ECMAScript and those featured work in JavaScript as well.  Besides, we used to call the older version ES5 and ES6 is the 2015 version with a lot of brilliant features. So, In this step by step tutorials, we will cover all the features with examples. Also, we will talk about Webpack and package bundlers as well.</p>
<h2>Why should I Learn ES6?</h2>
<p>Well, if you come here to learn ES6, you probably have a good reason right! Most developers use the ES6 code in their project. Also, most software development companies require you to know ES6. Besides, the new features are amazing. It helps you write code in more efficient ways.  You can use Class, Modules, Array Functions and more cool features. It’s the next version of JavaScript, which delivers new language features. So, let&#8217;s learn the ES6 basics and configuration.</p>
<h2>Learn ES6 Basics Introduction and Configuration</h2>
<p>Some modern browsers support ES6 syntax now. Chrome 60+ almost support all ES6 features. But, as of writing this article, most browsers don&#8217;t support ES6 features. Therefore, if you want to write code for production, you must convert your code to old JavaScript. So, now we need a tool like Babeljs. If you don&#8217;t know what it is. It&#8217;s simple a JavaScript compiler. It takes the ES6 code and converts it to old JavaScript code.</p>
<h2>Configure Babeljs</h2>
<p>Let&#8217;s setup Babeljs and use it. Also, you can read the documentation if you want. But I will explain it with step by step ways.</p>
<h2>Steps to Configure Babeljs</h2>
<p>Firstly, you must have NPM installed on your system. If you don&#8217;t have it, just go to nodejs.org download and install it. It will not take more than 2 minutes.</p>
<p>Secondly, create a new folder for your ES6 learning anywhere in your system. Then, open terminal or CMD and run the following command to install Bablejs.</p>
<pre class="lang:default decode:true">npm install --save-dev babel-cli babel-preset-env
</pre>
<p>That will install Bablejs and preset env.</p>
<p>Create a package.json file in your directory and paste the following code.</p>
<pre class="lang:default decode:true">{
    "name": "my-project",
    "version": "1.0.0",
    "scripts": {
        "build": "babel src -d output"
    },
    "devDependencies": {
        "babel-cli": "^6.26.0",
        "babel-preset-env": "^1.6.1",
    }
}
</pre>
<p>Everything should look familiar to you if you have ever used NPM. The script part registers the build command for NPM. It means you can run &#8216;<span style="background-color: #d1d1d1;"><em> npm<span style="background-color: #d1d1d1;"> run b</span>uild</em></span> &#8216; in your current directory and it will run the babel in the <strong>src</strong> folder and compile the files to the <strong>output</strong> directory.</p>
<p>Your project structure should look like this.</p>
<figure id="attachment_13956" aria-describedby="caption-attachment-13956" style="width: 575px" class="wp-caption aligncenter"><a href="https://www.technig.com/wp-content/uploads/2017/11/babel-configuration.png"><img decoding="async" class="wp-image-13956" src="http://3.90.216.52/wp-content/uploads/2017/11/babel-configuration.png" alt="Babel Configuration" width="575" height="312" srcset="https://www.technig.com/wp-content/uploads/2017/11/babel-configuration.png 806w, https://www.technig.com/wp-content/uploads/2017/11/babel-configuration-300x163.png 300w, https://www.technig.com/wp-content/uploads/2017/11/babel-configuration-768x416.png 768w" sizes="(max-width: 575px) 100vw, 575px" /></a><figcaption id="caption-attachment-13956" class="wp-caption-text">Babel Configuration</figcaption></figure>
<p>The final step is to create a<em><span style="background-color: #d1d1d1;"> .babelrc</span> </em>file and write the following code.</p>
<pre class="lang:default decode:true ">{
  "presets": ["env"]
}
</pre>
<p>In older versions of Babel, we used to write the presets value like es2015 or es2016. Now you don&#8217;t need to since you have preset-env and it will work just fine.</p>
<p>Now, create any file in the src directory and write ES6 code. Then, run the &#8216; npm run build &#8216; command in CMD.</p>
<p>I have a file called Persion.js in the <strong>src</strong> directory.</p>
<pre class="theme:sublime-text lang:js decode:true ">class User {
  constructor(name) {
    this.name = name;
  }
}
</pre>
<p>I wrote a simple class usage structure in ES6. When it compiles, it will look like this</p>
<pre class="theme:sublime-text lang:js decode:true ">"use strict";

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var User = function User(name) {
  _classCallCheck(this, User);

  this.name = name;
};</pre>
<p>You don&#8217;t need to worry about how long it is and how hard it&#8217;s to read. Just read the ES6 version. Also, that&#8217;s super clean.</p>
<h2>Conclusion</h2>
<p>I think it&#8217;s enough about ES6 basics part. Besides, we are supposed to make clean and short tutorials. So, I hope they learn the ES6 basics part has been informative for you. If you have any questions, feel free to comment below.</p>
<p>The post <a href="https://www.technig.com/learn-es6-basics-introduction/">Learn ES6 : Basic Introduction and Configuration</a> appeared first on <a href="https://www.technig.com">TECHNIG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.technig.com/learn-es6-basics-introduction/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">13942</post-id>	</item>
	</channel>
</rss>
