<?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>jsfeatures Archives - SoftUni Global</title>
	<atom:link href="https://softuni.org/tag/jsfeatures/feed/" rel="self" type="application/rss+xml" />
	<link>https://softuni.org/tag/jsfeatures/</link>
	<description>Learn Programming and Start a Developer Job</description>
	<lastBuildDate>Thu, 25 Aug 2022 12:01:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://softuni.org/wp-content/uploads/2022/04/cropped-SoftUni-Global-Logo-Square-notext-32x32.png</url>
	<title>jsfeatures Archives - SoftUni Global</title>
	<link>https://softuni.org/tag/jsfeatures/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>All The New JavaScript Features Coming Up with ECMAScript 2022</title>
		<link>https://softuni.org/dev-talks/all-the-new-javascript-features-coming-up-with-ecmascript-2022/</link>
					<comments>https://softuni.org/dev-talks/all-the-new-javascript-features-coming-up-with-ecmascript-2022/#respond</comments>
		
		<dc:creator><![CDATA[Nikol Ruseva]]></dc:creator>
		<pubDate>Thu, 25 Aug 2022 08:48:25 +0000</pubDate>
				<category><![CDATA[Dev Talks]]></category>
		<category><![CDATA[ecmascript]]></category>
		<category><![CDATA[ecmascript2022]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[js2022]]></category>
		<category><![CDATA[jsfeatures]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[software engineering]]></category>
		<guid isPermaLink="false">https://softuni.org/?p=22801</guid>

					<description><![CDATA[<p>In this article, you will learn about the new JavaScript features of 2022 and how to use them to ease your work as a software developer.</p>
<p>The post <a href="https://softuni.org/dev-talks/all-the-new-javascript-features-coming-up-with-ecmascript-2022/">All The New JavaScript Features Coming Up with ECMAScript 2022</a> appeared first on <a href="https://softuni.org">SoftUni Global</a>.</p>
]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="22801" class="elementor elementor-22801" data-elementor-post-type="post">
						<section class="elementor-section elementor-top-section elementor-element elementor-element-5d002d1 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="5d002d1" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8a58875" data-id="8a58875" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ef0ae54 elementor-widget elementor-widget-text-editor" data-id="ef0ae54" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>The thirteenth edition of ECMAScript Language specification was officially approved on June 22, 2022. With its release, new features were added to the JavaScript language:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-33f28ac elementor-widget elementor-widget-text-editor" data-id="33f28ac" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<ul><li>Method .at();</li><li>Object.hasOwn();</li><li>RegExp: match indices(‘d’ flag);</li><li>Error: .cause;</li><li>New members of Classes;</li><li>Private Slot Checks;</li><li>Top-level Await.</li></ul><p>Now let’s find out more about each new feature.</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-6323310 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="6323310" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f007326" data-id="f007326" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ad329c3 elementor-widget elementor-widget-heading" data-id="ad329c3" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Method .at()</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-a1dc8e1 elementor-widget elementor-widget-text-editor" data-id="a1dc8e1" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>The method .at() is supported by indexable values like <strong>Array</strong>, <strong>String</strong>, or <strong>TypedArray</strong>. It takes a <strong>positive or negative</strong> integer value and returns the element at the given index. </p><p>In this example, there is an array with three elements, which means that its length is 3. The first element is at index 0 and the last is at index array length -1 (in this example at index 2).</p><p>To check what the element at a certain index is, use the bracket operator (<strong>animals[0]</strong>). For indexes out of the range, the program returns <strong>“Undefined“</strong>.</p>								</div>
				</div>
				<div class="elementor-element elementor-element-dd680b8 elementor-widget elementor-widget-code-highlight" data-id="dd680b8" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>let animals = ["Cat", "Dog", "Cow"];

console.log(animals[0]);
console.log(animals[animals.length - 1]) 
console.log(animals[animals.length])

//Cat
//Cow
//undefined
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-08e0f24 elementor-widget elementor-widget-text-editor" data-id="08e0f24" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>The new feature works exactly like the bracket operator but it allows <strong>negative</strong> <strong>indexing</strong> of elements. The last element is accessed easily by replacing <strong>animals[animals.length &#8211; 1]</strong> with <strong>animals.at(-1)</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-7de01d9 elementor-widget elementor-widget-code-highlight" data-id="7de01d9" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>let animals = ["Cat", "Dog", "Cow"];

console.log(animals.at(0));
console.log(animals.at(-1));

//Cat
//Cow
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-df93b30 elementor-widget elementor-widget-code-highlight" data-id="df93b30" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>//Example with a String
let string = "Hello, World!";

console.log(string.at(-1));

//!
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-fc46f4b elementor-widget elementor-widget-spacer" data-id="fc46f4b" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-9ab65d9 elementor-widget elementor-widget-heading" data-id="9ab65d9" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Object: .hasOwn()</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-f4ef827 elementor-widget elementor-widget-text-editor" data-id="f4ef827" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Object.hasOwn() returns <strong>true</strong> if the specified object has the indicated property as its own property. If the property is inherited or does not exist, the method returns <strong>false</strong>.</p><p>Object.hasOwn() is intended as a <strong>replacement</strong> of Object.hasOwnProperty()</p>								</div>
				</div>
				<div class="elementor-element elementor-element-fce8012 elementor-widget elementor-widget-text-editor" data-id="fce8012" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>Before:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-106ce0b elementor-widget elementor-widget-code-highlight" data-id="106ce0b" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>let user = {
name: 'John Doe',
role: 'Admin'
};

console.log(user.hasOwnProperty('role'));
console.log(user.hasOwnProperty('age'));

//true
//false

</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-1c4266a elementor-widget elementor-widget-text-editor" data-id="1c4266a" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>After:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-176f2ab elementor-widget elementor-widget-code-highlight" data-id="176f2ab" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>let user = {
name: 'John Doe',
role: 'Admin'
};

console.log(Object.hasOwn(user, 'role'));
console.log(Object.hasOwn(user, 'age'));

//true
//false
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-3af7b62 elementor-widget elementor-widget-spacer" data-id="3af7b62" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-d09faa1 elementor-widget elementor-widget-heading" data-id="d09faa1" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">RegExp: match indices(‘d’ flag)
</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-2c54e67 elementor-widget elementor-widget-text-editor" data-id="2c54e67" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>ECMA Script 2022 introduced a new <strong>/d flag</strong> for Regular Expressions. It provides some <strong>additional</strong> <strong>information</strong> about the start and indices position end of each match in the input string.</p>								</div>
				</div>
				<div class="elementor-element elementor-element-281192f elementor-widget elementor-widget-text-editor" data-id="281192f" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Without the new feature the following information has been provided:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-a4bc05d elementor-widget elementor-widget-code-highlight" data-id="a4bc05d" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>let string = 'hello1helloAll';
let regEx = /hello(\w)/g;
let result = [...string.matchAll(regEx)];
console.log(result[0]);
//[ 'hello1', '1', index: 0, input: 'hello1helloAll', groups: undefined ]

let string = 'hello1helloAll';
let regEx = /hello(\w)/g;
let result = [...string.matchAll(regEx)];
let regEx2 = /hello(\w)/dg;
let result2 = [...string.matchAll(regEx2)];
console.log(result2[0]);

</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-2182bd2 elementor-widget elementor-widget-text-editor" data-id="2182bd2" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>With the /d flag there is an array with the indices of the different elements that match the regex:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-c698c39 elementor-widget elementor-widget-code-highlight" data-id="c698c39" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>[
  'hello1',
  '1',
  index: 0,
  input: 'hello1helloAll',
  groups: undefined,
  indices: [ [ 0, 6 ], [ 5, 6 ], groups: undefined ]
]

</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-8252814 elementor-widget elementor-widget-spacer" data-id="8252814" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-d07cf8b elementor-widget elementor-widget-heading" data-id="d07cf8b" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Error: .cause</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-68bcdf6 elementor-widget elementor-widget-text-editor" data-id="68bcdf6" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>With the Error .cause, you can add <strong>more</strong> <strong>essential</strong> <strong>information</strong> <strong>to the errors</strong> you receive. You should specify the error options as a second parameter, and with the “cause“ key you can pass the error that you want to chain.</p>								</div>
				</div>
				<div class="elementor-element elementor-element-b2ba546 elementor-widget elementor-widget-text-editor" data-id="b2ba546" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>Before:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-9e71db4 elementor-widget elementor-widget-code-highlight" data-id="9e71db4" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>const weatherNow = async (city) => {
    try {
      const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=67a20d293903cbcf9aab38633b30fbf9`);
      const info = await response.json();
      const description = info.weather[0].description;
      return description;
    } catch (error) {
throw new Error('Something went wrong')
    }
  }
 
try {
    await weatherNow('');           //Empty string
} catch(error) {
    console.log(error);
}

//Error: Something went wrong
    //at weatherNow (<anonymous>:8:7)
    //at async <anonymous>:13:5
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-b3726fb elementor-widget elementor-widget-text-editor" data-id="b3726fb" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>After:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-19a810c elementor-widget elementor-widget-code-highlight" data-id="19a810c" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>const weatherNow = async (city) => {
    try {
      const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=67a20d293903cbcf9aab38633b30fbf9`);
      const info = await response.json();
      const description = info.weather[0].description;
      return description;
    } catch (error) {
throw new Error('Something went wrong', { cause: error })
    }
  }
 
try {
    await weatherNow('');        //Empty String
} catch(error) {
    console.log(error.cause);
}

//TypeError: Cannot read properties of undefined (reading '0')
    //at weatherNow (<anonymous>:5:39)
    //at async <anonymous>:13:5

</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-4fef07b elementor-widget elementor-widget-spacer" data-id="4fef07b" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-e27eba3 elementor-widget elementor-widget-heading" data-id="e27eba3" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">New Members of Classes </h2>				</div>
				</div>
				<div class="elementor-element elementor-element-4fa378f elementor-widget elementor-widget-text-editor" data-id="4fa378f" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Static class fields and methods are not used on instances of a class. Instead, they can be called on the <strong>class</strong> <strong>itself</strong> and are declared using the <strong>static</strong> <strong>keyword</strong>. Static methods are often utility functions and helpers, whereas static properties are useful for <strong>caches</strong>, <strong>fixed-configuration</strong>, or any other data we do not need to be replicated across instances.</p>								</div>
				</div>
				<div class="elementor-element elementor-element-60562d3 elementor-widget elementor-widget-text-editor" data-id="60562d3" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>Before:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-e6cd331 elementor-widget elementor-widget-code-highlight" data-id="e6cd331" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>class User {
    firstName = 'Jon';
};
  
console.log(User.firstName); 
  
//undefined
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-46722af elementor-widget elementor-widget-text-editor" data-id="46722af" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><strong>After:</strong></p>								</div>
				</div>
				<div class="elementor-element elementor-element-16da158 elementor-widget elementor-widget-code-highlight" data-id="16da158" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>class User {
    static firstName = 'Jon';
};

console.log(User.firstName); 
  
//Jon
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-ce1c637 elementor-widget elementor-widget-spacer" data-id="ce1c637" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-c5073ab elementor-widget elementor-widget-heading" data-id="c5073ab" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Private Slot Checks</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-da6cbf6 elementor-widget elementor-widget-text-editor" data-id="da6cbf6" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>EcmaScript 2022 added new features such as <strong>private instance fields</strong>, <strong>methods</strong>, and <strong>accessors</strong>. To initialize a private method or a field before you had to add an underscore at the beginning of its name, but this did not guarantee that the method/field will be private. Now, you just need to add a <strong>#</strong> at the beginning of the method name to have it declared as <strong>private</strong>.</p><p>It looks like this:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-baf627c elementor-widget elementor-widget-code-highlight" data-id="baf627c" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>class User {
    firstName = 'John';
    lastName = 'Doe';
    #role = 'Admin';
}
 
const adminUser = new User();
console.log(adminUser.role); 
  
//undefined</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-4ce8580 elementor-widget elementor-widget-code-highlight" data-id="4ce8580" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>class User {
    firstName = 'John';
    lastName = 'Doe';
    role = 'Admin';
    #sayHi() {
        return this.firstName + ' ' + this.lastName + ' with role ' + this.role + ' says Hi!';
    }
}
 
  const adminUser = new User();
  console.log(adminUser.sayHi());      
  
//TypeError: adminUser.sayHi is not a function
</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-16571d8 elementor-widget elementor-widget-spacer" data-id="16571d8" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-cc381cf elementor-widget elementor-widget-heading" data-id="cc381cf" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Top-level Await 
</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-4f978e3 elementor-widget elementor-widget-text-editor" data-id="4f978e3" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Before ECMAScript 2022 await could only be used in the scope of asynchronous functions. Now the await keyword can be used <strong>outside of an async function</strong> within a JavaScript module. This means that a module waits for its child modules that use await to execute before it runs itself.</p>								</div>
				</div>
				<div class="elementor-element elementor-element-b6b7e1a elementor-widget elementor-widget-code-highlight" data-id="b6b7e1a" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=london&appid=67a20d293903cbcf9aab38633b30fbf9`);
const info = await response.json();
const description = info.weather[0].description;
console.log(description);</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-7550496 elementor-widget elementor-widget-text-editor" data-id="7550496" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>We will receive an error:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-6fc07b7 elementor-widget elementor-widget-code-highlight" data-id="6fc07b7" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>SyntaxError: await is only validin async functions and the top-level bodies of modules</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-4259b60 elementor-widget elementor-widget-text-editor" data-id="4259b60" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>With ECMAScript 2022  it works fine and you will see the following:</p>								</div>
				</div>
				<div class="elementor-element elementor-element-fe5b0da elementor-widget elementor-widget-code-highlight" data-id="fe5b0da" data-element_type="widget" data-widget_type="code-highlight.default">
				<div class="elementor-widget-container">
							<div class="prismjs-default copy-to-clipboard ">
			<pre data-line="" class="highlight-height language-javascript line-numbers">
				<code readonly="true" class="language-javascript">
					<xmp>//clear sky</xmp>
				</code>
			</pre>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-4c289cd elementor-widget elementor-widget-spacer" data-id="4c289cd" data-element_type="widget" data-widget_type="spacer.default">
				<div class="elementor-widget-container">
							<div class="elementor-spacer">
			<div class="elementor-spacer-inner"></div>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-ebe98e9 elementor-widget elementor-widget-heading" data-id="ebe98e9" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h2 class="elementor-heading-title elementor-size-xl">Conclusion</h2>				</div>
				</div>
				<div class="elementor-element elementor-element-8d43d09 elementor-widget elementor-widget-text-editor" data-id="8d43d09" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p>Nowadays when technology is rapidly evolving being <strong>up to date</strong> is an important part of working as a software developer.</p><p>The EcmaScript specification for 2022 contains some <strong>significant</strong> <strong>changes</strong> that aim to provide convenience and efficiency in programming by allowing you to write more <strong>expressive</strong> and <strong>concise</strong> <strong>code</strong>. After reading this post, you are now familiar with all of the new features and it is up to you to choose which of them to use into your JavaScript programming.</p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-5ef077c elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="5ef077c" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c75d272" data-id="c75d272" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
							</div>
		</div>
					</div>
		</section>
				</div>
		<p>The post <a href="https://softuni.org/dev-talks/all-the-new-javascript-features-coming-up-with-ecmascript-2022/">All The New JavaScript Features Coming Up with ECMAScript 2022</a> appeared first on <a href="https://softuni.org">SoftUni Global</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://softuni.org/dev-talks/all-the-new-javascript-features-coming-up-with-ecmascript-2022/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: softuni.org @ 2026-06-10 00:02:07 by W3 Total Cache
-->