{"id":3230,"date":"2018-02-16T18:28:09","date_gmt":"2018-02-16T12:58:09","guid":{"rendered":"https:\/\/code4developers.com\/?p=3230"},"modified":"2018-02-16T18:28:09","modified_gmt":"2018-02-16T12:58:09","slug":"whats-new-ecmascript-2018","status":"publish","type":"post","link":"https:\/\/code4developers.com\/whats-new-ecmascript-2018\/","title":{"rendered":"What\u2019s new in ECMAScript 2018"},"content":{"rendered":"<h3 id=\"four-new-feature-proposals-for-the-specification-underlying-javascript-are-finalized-and-four-others-are-under-consideration\">Four new feature proposals for the specification underlying JavaScript are finalized and four others are under consideration<\/h3>\n<p><!--more--><\/p>\n<p>ECMAScript, the standard specification underlying JavaScript, is on track for a new release, likely in June.<\/p>\n<p>So far, four proposals have been finalized for inclusion in the ECMAScript 2018 specification, said Zibi Braniecki, a senior software engineer at Mozilla who participates in the development of ECMAScript.<\/p>\n<p>The four proposals include:<\/p>\n<ul>\n<li>Lifting of the template literal restriction, to enable the embedding of languages, including domain-specific languages (DSLs). Currently, restrictions on escape clauses make this a problem. The revision cleans up the behavior of literals, letting them be used for DSLs so programmers can create their own mini-languages if needed.<\/li>\n<li>Adding the <code>s<\/code> (dotAll) flag for regular expressions, providing consistent behavior for these expressions. The feature is intended to address limitations in which the dot (<code>.<\/code>) in regular expressions does not match line-terminator characters, said author Axel Rauschmeyer, who has focused on JavaScript. The <code>s<\/code> flag changes that. This flag will operate on an opt-in basis, so existing regular expressions patterns will not be affected.<\/li>\n<li>Async iterators, adding syntactic support for asynchronous iteration using AsyncIterable and AsyncIterator protocols. The feature makes possible a for-wait-of iteration statement while adding syntax for creating async generator functions and methods.<\/li>\n<li>Rest\/spread properties, providing a minor syntactic improvement.<\/li>\n<\/ul>\n<p>Async iterators enable a new class of software to be written, solving new classes of problems, Braniecki said. The capability combines two powerful features added to JavaScript in recent years: asynchronous operations and iterators\/generators. Generators and iterators let code be executed lazily while asynchronous operations allow for code that does not block. Combined, these let developers write lazy code that will not block.<\/p>\n<aside id=\"\" class=\"nativo-promo nativo-promo-1 smartphone\"><\/aside>\n<h4 id=\"there-are-four-other-features-under-strong-consideration-which-would-make-it-easier-to-program-with-javascript-braniecki-said-these-include\">There are four other features under strong consideration, which would make it easier to program with JavaScript, Braniecki said. These include:<\/h4>\n<ul>\n<li>Regexp (regular expression) look-behind assertions, fixing a shortcoming with lookarounds, which are zero-width assertions that match a string without consuming anything. Currently, lookaround assertions can be used in a forward direction but not a backward direction. With lookbehind assertions, developers would be able to ensure that a pattern is or is not preceded by another; for example, matching a dollar amount without capturing the dollar sign.<\/li>\n<li>Regexp Unicode property escapes, giving developers a better way to access Unicode character properties. Property escapes in the form of<code> \\p{\u2026}<\/code> and <code>\\P{\u2026}<\/code> would be added.<\/li>\n<li><code>Promise.prototype.finally<\/code>, for writing cleaner code when a programmer does not does not close a socket or clean up memory. A class of errors would be removed.<\/li>\n<li>Updating the function <code>Function.prototype.toString<\/code>. The <code>toString ()<\/code> method would return a string representing a function\u2019s source code.<\/li>\n<\/ul>\n<p>Braniecki expects the ECMAScript 2018 features to be implemented in browsers this year. Some already have been implemented.<\/p>\n<p>Braniecki considers ECMAScript 2018 to be a fairly modest release. Next year, he anticipates bigger capabilities for ECMAScript, with conversations being held about asynchronous iterators and extending classes.<\/p>\n<h3 class=\"entry-title\">ECMAScript standardization Stages<\/h3>\n<div class=\"entry-content\">\n<p>I guess you have seen \u201cX is in Stage Y\u201d when you look at some cool new JavaScript feature. This block is an attempt to give an introduction to what that means.<\/p>\n<h2 id=\"babel\"><a href=\"https:\/\/babeljs.io\/docs\/plugins\/\" target=\"_blank\" rel=\"noopener\">Babel<\/a><\/h2>\n<p style=\"text-align: left;\">[infobox]\n<p style=\"text-align: left;\">Stage 0 \u2013 Strawman: just an idea, possible Babel plugin.<\/p>\n<p style=\"text-align: left;\">Stage 1 \u2013 Proposal: this is worth working on.<\/p>\n<p style=\"text-align: left;\">Stage 2 \u2013 Draft: initial spec.<\/p>\n<p style=\"text-align: left;\">Stage 3 \u2013 Candidate: complete spec and initial browser implementations.<\/p>\n<p style=\"text-align: left;\">Stage 4 \u2013 Finished: will be added to the next yearly release. [\/infobox]\n<\/div>\n<h2 id=\"where-to-get-the-ecmascript-2018-specification\">Where to get the ECMAScript 2018 specification<\/h2>\n<p>You can read the <a href=\"https:\/\/tc39.github.io\/ecma262\/\" rel=\"nofollow noopener\" target=\"_blank\">draft specification on GitHub<\/a>. A <a href=\"https:\/\/github.com\/tc39\/proposals\" rel=\"nofollow noopener\" target=\"_blank\">list of proposals<\/a> is posted as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Four new feature proposals for the specification underlying JavaScript are finalized and four others are under consideration<\/p>\n","protected":false},"author":7,"featured_media":3125,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[109,110,111,22,112],"powerkit_post_featured":[],"class_list":{"0":"post-3230","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript","8":"tag-ecma-script","9":"tag-ecmascript-2018-specification","10":"tag-ecmascript-standardization-stages","11":"tag-javascript","12":"tag-javascript-new-features"},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/ecma.png?fit=400%2C277&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8NAi4-Q6","jetpack-related-posts":[{"id":3119,"url":"https:\/\/code4developers.com\/difference-between-javascript-and-ecmascript\/","url_meta":{"origin":3230,"position":0},"title":"What\u2019s the difference between JavaScript and ECMAScript?","author":"Arif Khoja","date":"October 31, 2017","format":false,"excerpt":"I\u2019ve tried googling \u201cthe difference between JavaScript and ECMAScript.\u201d I ended up having to wade through a sea of ambiguous and seemingly conflicting results: \u201cECMAScript is a standard.\u201d \u201cJavaScript is a standard.\u201d \u201cECMAScript is a specification.\u201d \u201cJavaScript is an implementation of the ECMAScript standard.\u201d \u201cECMAScript is standardized JavaScript.\u201d \u201cECMAScript is\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2662,"url":"https:\/\/code4developers.com\/ecmascript-5-strict-mode-json\/","url_meta":{"origin":3230,"position":1},"title":"ECMAScript5 Strict Mode, JSON, and More&#8230;.","author":"Arif Khoja","date":"June 25, 2017","format":false,"excerpt":"Introduction There are a number of other new features and APIs that need attention, as well. The largest of which are\u00a0Strict Mode\u00a0and native\u00a0JSON\u00a0support. Strict Mode Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a \u201cstrict\u201d operating context. This\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3321,"url":"https:\/\/code4developers.com\/spread-syntax-in-javascript\/","url_meta":{"origin":3230,"position":2},"title":"Spread syntax (three dots) in JavaScript","author":"Yatendrasinh Joddha","date":"March 21, 2018","format":false,"excerpt":"Spread syntax which is used by typing three dots (...) in JavaScript. It allows an array expression or string or anything which can be iterating to be expanded in places where zero or more arguments for function calls\u00a0or elements for array are expected. It can also be used for an\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4103,"url":"https:\/\/code4developers.com\/top-array-hacks\/","url_meta":{"origin":3230,"position":3},"title":"Top Array Hacks","author":"Arif Khoja","date":"March 14, 2019","format":false,"excerpt":"Arrays are everywhere in JavaScript and with the new\u00a0spread operators\u00a0introduced in ECMAScript 6, you can do awesome things with them. In this post I will show you 3 useful tricks you can use when programming. 1. Iterating through an empty\u00a0array JavaScript arrays are sparse in nature in that there are\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3311,"url":"https:\/\/code4developers.com\/default-parameter-in-a-javascript-function\/","url_meta":{"origin":3230,"position":4},"title":"Default Parameter in JavaScript function","author":"Yatendrasinh Joddha","date":"March 17, 2018","format":false,"excerpt":"In any programming language we often require having default parameter or default value for the parameter in a function. JavaScript allow us to initialize parameter a default value. If you are not passing any value to the parameter, then the default value of the parameter will be undefined. Let's consider\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2610,"url":"https:\/\/code4developers.com\/semicolon-in-javascript\/","url_meta":{"origin":3230,"position":5},"title":"Importance of Semicolon [;] In JavaScript","author":"Yatendrasinh Joddha","date":"June 19, 2017","format":false,"excerpt":"It is said that in JavaScript semicolons are not compulsory. It's true, because JavaScript automatically inserts a semicolons at required place and it is know as \"Automatic Semicolon Insertion\". This behavior of JavaScript confuses us a lot. This article is written for those who have just started writing JavaScript and\u2026","rel":"","context":"In &quot;JavaScript&quot;","block_context":{"text":"JavaScript","link":"https:\/\/code4developers.com\/category\/javascript\/"},"img":{"alt_text":"javascript","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/10\/javascript.jpg?fit=750%2C422&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/comments?post=3230"}],"version-history":[{"count":5,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3230\/revisions"}],"predecessor-version":[{"id":3235,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3230\/revisions\/3235"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media\/3125"}],"wp:attachment":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media?parent=3230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/categories?post=3230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/tags?post=3230"},{"taxonomy":"powerkit_post_featured","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/powerkit_post_featured?post=3230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}