{"id":11388,"date":"2022-01-13T10:00:00","date_gmt":"2022-01-13T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=11388"},"modified":"2022-01-12T19:37:47","modified_gmt":"2022-01-12T10:37:47","slug":"es9-features","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/11388","title":{"rendered":"ES9 Features"},"content":{"rendered":"\n<p>EcmaScript is the \u201cofficial\u201d name for JavaScript. It was eventually abandoned and ES3.1 became ES5, which is the JavaScript version used in the \u201cHTML5\u201d world. ECMAScript is the \u201cstandard for\u201d the JavaScript language.<\/p>\n\n\n\n<p>ECMAScript2018 or ES9 has been evolving for the last few years and it has improved a lot.<\/p>\n\n\n\n<p>&nbsp;The top features of the ES9 are<\/p>\n\n\n\n<p><strong>1.Object Rest\/Spread Properties<\/strong><\/p>\n\n\n\n<p>If you want to extract an object excluding one or more properties, you can do it in ES9. It was not possible in the previous versions.<br>Here is an example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1016\" height=\"380\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/extract_properties.png\" alt=\"\" class=\"wp-image-11390\" \/><\/figure>\n\n\n\n<p>Output is<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"291\" height=\"20\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/result_of_extract_properties.png\" alt=\"\" class=\"wp-image-11391\" \/><\/figure>\n\n\n\n<p><strong>2<\/strong>.<strong>Regular Expressions (RegExp) named Groups<\/strong><\/p>\n\n\n\n<p>A capture group can&nbsp;be given a name using the&nbsp;<code>(?&lt;name&gt;...)<\/code>&nbsp;syntax. The groups can be accessed via the \u2018groups\u2019 property of the regular expression\u2019s result. Numbered references to groups are also created as usual.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"906\" height=\"382\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/regular_expression.png\" alt=\"\" class=\"wp-image-11392\" \/><\/figure>\n\n\n\n<p>Output is :<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"331\" height=\"19\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/result_of_regular_expression.png\" alt=\"\" class=\"wp-image-11393\" \/><\/figure>\n\n\n\n<p><strong>3.Asynchronous Iterators<\/strong><\/p>\n\n\n\n<p>ES9 introduces the AsyncIterator interface, an asynchronous iteration statement (for \u2014 await \u2014 of), and async generator functions. The for \u2014 await \u2014 of statement creates a loop iterating over async iterable objects as well as on sync iterables. The loop can only be used in an async function.<\/p>\n\n\n\n<p>Syntax:<br>for await (const variable of iterable) {<br>     statement<br>}<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>4<\/strong>. <strong>Promise.prototype.finally<\/strong><\/p>\n\n\n\n<p>Promises now include a \u2018finally\u2019 method. You can use this when you want to perform an action irrespective of the promise being fulfilled or rejected. A good example of this would be turning off a loader after an API call is completed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"954\" height=\"742\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/finally_in_promise.png\" alt=\"\" class=\"wp-image-11394\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/output_when_200.png\" alt=\"\" class=\"wp-image-11395\" width=\"361\" height=\"61\" \/><\/figure>\n\n\n\n<p>Output when 200 is passed.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/output_when_500.png\" alt=\"\" class=\"wp-image-11396\" width=\"367\" height=\"62\" \/><\/figure>\n\n\n\n<p>Output when 500 is passed.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>These were the features of ES9 that will definitely help to code in a better way.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Tsuki<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11388\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/11388\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"ES9 Features\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11388\" data-text=\"ES9 Features\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11388\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11388\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>EcmaScript is the \u201cofficial\u201d name for JavaScript. It was eventually abandoned and ES3.1 became ES5, which is t [&hellip;]<\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[35],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11388"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=11388"}],"version-history":[{"count":2,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11388\/revisions"}],"predecessor-version":[{"id":11401,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11388\/revisions\/11401"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=11388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=11388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=11388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}