{"id":992,"date":"2019-03-20T14:15:47","date_gmt":"2019-03-20T22:15:47","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=992"},"modified":"2019-05-24T14:54:02","modified_gmt":"2019-05-24T22:54:02","slug":"es6-es2015-additions","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=992","title":{"rendered":"ES6 \/ ES2015 Additions"},"content":{"rendered":"\r\n<h2 class=\"wp-block-heading\"><strong>Arrow functions (or fat functions)?<\/strong><strong>Arrow functions (or fat functions)<\/strong><\/h2>\r\n\r\n\r\n\r\n<p>An <strong>arrow function expression<\/strong> is a syntactically compact\u00a0alternative to a\u00a0regular\u00a0<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/function\">function expression<\/a>, although without\u00a0its own bindings to the\u00a0<code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/this\">this<\/a><\/code>, <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Functions\/arguments\">arguments<\/a><\/code>, <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/super\">super<\/a><\/code>, or <code><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/new.target\">new.target<\/a><\/code>\u00a0keywords. Arrow\u00a0function expressions are ill suited as\u00a0methods,\u00a0and they cannot\u00a0be used as constructors.<\/p>\r\n\r\n\r\n\r\n<p>The key difference, despite being shorter to write, is that arrow functions do not create their own value for &#8216;this&#8217;.<\/p>\r\n\r\n\r\n\r\n<p><br \/>If the function body contains just a single statement, you can omit the brackets and write all on a single line:<br \/><br \/><code>const myFunction = () =&gt; doSomething() <\/code><br \/><br \/>https:\/\/flaviocopes.com\/javascript-arrow-functions\/<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\"><strong>(<\/strong>parameters<strong>) =&gt; {<\/strong> statements <strong>}<br \/><\/strong><\/pre>\r\n\r\n\r\n\r\n<p><strong>Arrow functions and Lexical this<\/strong><\/p>\r\n<p><a href=\"https:\/\/hackernoon.com\/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4\">https:\/\/hackernoon.com\/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4<\/a><\/p>\r\n<h2 class=\"wp-block-heading\">Template Strings \/ Template Literals<\/h2>\r\n\r\n\r\n\r\n<p><br \/><a href=\"https:\/\/wesbos.com\/javascript-template-strings\/\">https:\/\/wesbos.com\/javascript-template-strings\/<\/a><\/p>\r\n\r\n\r\n\r\n<h2><strong>Object Destructuring<\/strong><\/h2>\r\n<p>https:\/\/dev.to\/sarah_chima\/object-destructuring-in-es6-3fm<\/p>\r\n<h2>Adding to Array<\/h2>\r\n<p>[&#8230;oldArray, itemToAdd]<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Arrow functions (or fat functions)?Arrow functions (or fat functions) An arrow function expression is a syntactically compact\u00a0alternative to a\u00a0regular\u00a0function expression, although without\u00a0its own bindings to the\u00a0this, arguments, super, or new.target\u00a0keywords. Arrow\u00a0function expressions are ill suited as\u00a0methods,\u00a0and they cannot\u00a0be used as constructors. The key difference, despite being shorter to write, is that arrow functions do not &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=992\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">ES6 \/ ES2015 Additions<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-992","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=992"}],"version-history":[{"count":11,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/992\/revisions"}],"predecessor-version":[{"id":1043,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/992\/revisions\/1043"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}