{"id":235444,"date":"2020-03-02T05:38:57","date_gmt":"2020-03-02T05:38:57","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=235444"},"modified":"2020-03-02T05:45:16","modified_gmt":"2020-03-02T05:45:16","slug":"basic-of-ecmascript-6","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/","title":{"rendered":"Basic of ECMAScript 6"},"content":{"rendered":"\n<p>ECMAScript 6 is also known as ES6 which was standardized by the ECMA International.<\/p>\n\n\n\n<p>In this blog, we will discuss the below concepts<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Arrow Function<\/strong><\/li><li><strong>Exponentiation Operator<\/strong><\/li><li><strong>Spread Operator<\/strong><\/li><\/ul>\n\n\n\n<p>Let&#8217;s start with one by one<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Arrow Function<\/strong><\/li><\/ol>\n\n\n\n<p>An arrow function is the shortest syntax to define a function<\/p>\n\n\n\n<p>In Normal Javascript, we define the function like this:-<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">function testAddition(x,y) {\n    return x + y;\n}<\/pre>\n\n\n\n<p>But in ES6 we can define the function like below:- <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">var x = (x,y) =&gt; x+y;<\/pre>\n\n\n\n<p>2. <strong>Exponentiation Operator<\/strong><\/p>\n\n\n\n<p>An Exponentiation Operator(**) returns the power of the first value according to the second value.<\/p>\n\n\n\n<p> For example:-<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">alert(2**2);<\/pre>\n\n\n\n<p>The above code will output 4.<\/p>\n\n\n\n<p>3. <strong>Spread Operator<\/strong><\/p>\n\n\n\n<p>Spread operator allows the developer to iterate the javascript array and perform some action like:- copy one array to another array, add some new index value in the array, etc<\/p>\n\n\n\n<p>For example:- <\/p>\n\n\n\n<p>In normal javascript, we iterate the array like this:- <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/define the result variable here\nvar result = 1;\n\n\/\/define the array here\nvar test_arr = [1,2,3,4,5];\n\n\/\/initialize the varaible here\nvar j;\n\n\/\/for loop starts\nfor(j = 0; j &lt; test_arr.length;j++) {\n\n    result *= test_arr[j];\n}\n\nalert(result);<\/pre>\n\n\n\n<p>In ES6:-<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">var spread_arr = {1,2,3,4,5};\n\nvar test = (a,b,c,d,e) =&gt; a*b*c*d*e;\nalert(test(...spread_arr));<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>There are many other features which I explained in future.<\/strong><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>ECMAScript 6 is also known as ES6 which was standardized by the ECMA International. In this blog, we will discuss the below concepts Arrow Function Exponentiation Operator Spread Operator Let&#8217;s start with one by one Arrow Function An arrow function is the shortest syntax to define a function In Normal Javascript, we define the function <a href=\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":218,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-235444","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Basic of ECMAScript 6 - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basic of ECMAScript 6 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"ECMAScript 6 is also known as ES6 which was standardized by the ECMA International. In this blog, we will discuss the below concepts Arrow Function Exponentiation Operator Spread Operator Let&#8217;s start with one by one Arrow Function An arrow function is the shortest syntax to define a function In Normal Javascript, we define the function [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-02T05:38:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-02T05:45:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jawahar Lal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jawahar Lal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\"},\"author\":{\"name\":\"Jawahar Lal\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/c297c18973bfa8496fc239f168fe23bd\"},\"headline\":\"Basic of ECMAScript 6\",\"datePublished\":\"2020-03-02T05:38:57+00:00\",\"dateModified\":\"2020-03-02T05:45:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\"},\"wordCount\":155,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\",\"url\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\",\"name\":\"Basic of ECMAScript 6 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2020-03-02T05:38:57+00:00\",\"dateModified\":\"2020-03-02T05:45:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Basic of ECMAScript 6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/c297c18973bfa8496fc239f168fe23bd\",\"name\":\"Jawahar Lal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/99f140efcc9e53f01a3a625b0067d464c7ae4cdb24303f0ffcf9d03d6b34a7d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/99f140efcc9e53f01a3a625b0067d464c7ae4cdb24303f0ffcf9d03d6b34a7d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Jawahar Lal\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/jawaharlal-oc401\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basic of ECMAScript 6 - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/","og_locale":"en_US","og_type":"article","og_title":"Basic of ECMAScript 6 - Webkul Blog","og_description":"ECMAScript 6 is also known as ES6 which was standardized by the ECMA International. In this blog, we will discuss the below concepts Arrow Function Exponentiation Operator Spread Operator Let&#8217;s start with one by one Arrow Function An arrow function is the shortest syntax to define a function In Normal Javascript, we define the function [...]","og_url":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2020-03-02T05:38:57+00:00","article_modified_time":"2020-03-02T05:45:16+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Jawahar Lal","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Jawahar Lal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/"},"author":{"name":"Jawahar Lal","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/c297c18973bfa8496fc239f168fe23bd"},"headline":"Basic of ECMAScript 6","datePublished":"2020-03-02T05:38:57+00:00","dateModified":"2020-03-02T05:45:16+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/"},"wordCount":155,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/","url":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/","name":"Basic of ECMAScript 6 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2020-03-02T05:38:57+00:00","dateModified":"2020-03-02T05:45:16+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/basic-of-ecmascript-6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Basic of ECMAScript 6"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/c297c18973bfa8496fc239f168fe23bd","name":"Jawahar Lal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/99f140efcc9e53f01a3a625b0067d464c7ae4cdb24303f0ffcf9d03d6b34a7d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/99f140efcc9e53f01a3a625b0067d464c7ae4cdb24303f0ffcf9d03d6b34a7d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Jawahar Lal"},"url":"https:\/\/webkul.com\/blog\/author\/jawaharlal-oc401\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/235444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/218"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=235444"}],"version-history":[{"count":6,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/235444\/revisions"}],"predecessor-version":[{"id":235497,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/235444\/revisions\/235497"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=235444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=235444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=235444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}