ECMAScript 2021 ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ


فهرست مطالب

    نمایش فهرست مطالب

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺨﺴﻧ ﻩﺭﺎﻤﺷ

.ES6 (2015) ﻭ ES5 (2009) :ﺪﻧﺍ ﻩﺪﺷ ﯼﺭﺍﺬﮕﻣﺎﻧ ﺩﺍﺪﻋﺍ ﺎﺑ JS ﯽﻤﯾﺪﻗ ﯼﺎﻫ ﻪﺨﺴﻧ

... ،ECMAScript 2016، 2017، 2018، 2019 :ﺪﻧﻮﺷ ﯽﻣ ﯼﺭﺍﺬﮕﻣﺎﻧ ﻝﺎﺳ ﺱﺎﺳﺍ ﺮﺑ ﺎﻫ ﻪﺨﺴﻧ ،2016 ﻝﺎ

ES2021 ﺭﺩ ﺪﯾﺪﺟ ﯼﺎﻫ ﯽﮔﮋﯾﻭ

  • Promise any():
    style="word-wrap: break-word;">const firs

  • ()ﻦﯾﺰﮕﯾﺎﺟ ﻪﺘﺷﺭ

  • (_) ﯼﺩﺪﻋ ﯼﺎﻫ ﻩﺪﻨﻨﮐﺍﺪﺟ


ES2022 ﺭﺩ ﺪﯾﺪﺟ ﯼﺎﻫ ﯽﮔﮋﯾﻭ

  • () ﺭﺩ ﻪﯾﺍﺭﺁ

  • () ﺭﺩ ﻪﺘﺷﺭ

  • RegExp /d

  • Object.hasOwn()

  • ﺖﻠﻋ .ﺎﻄﺧ

  • ﺕﺍﺩﺭﺍﻭ ﺮﻈﺘﻨﻣ

  • ﯽﺻﻮﺼﺧ ﯼﺎﻫ ﻪﻨﯿﻣﺯ ﻭ ﺎﻫ ﺵﻭﺭ

  • ﺱﻼﮐ ﺪﻠﯿﻓ ﯼﺎﻫ ﻪﯿﻣﻼﻋﺍ

ﺭﺍﺪﺸﻫ

.ﺪﻨﺘﺴﻫ ﺪﯾﺪﺟ ﺎﺘﺒﺴﻧ ﺎﻫ ﯽﮔﮋﯾﻭ ﻦﯾﺍ

(Polyfill) ﺪﻨﺷﺎﺑ ﻪﺘﺷﺍﺩ ﺯﺎﯿﻧ ﻦﯾﺰﮕﯾﺎﺟ ﺪﮐ ﮏﯾ ﻪﺑ ﺖﺳﺍ ﻦﮑﻤﻣ ﯽﻤﯾﺪﻗ ﯼﺎﻫﺮﮔﺭﻭﺮﻣ


()ReplaceAll ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺘﺷﺭ

ES2021 ﯼﺍ ﻪﺘﺷﺭ ﺵﻭﺭ replaceAll() ﺩﺮﮐ ﯽﻓﺮﻌﻣ ﺍﺭ:

ﻝﺎﺜﻣ

text = text.replaceAll("Cats","Dogs");
text = text.replaceAll("cats","dogs");

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The replaceAll() Method</h2>

<p>ES2021 intoduced the string method replaceAll().</p>

<p id="demo"></p>

<script>
let text = "I love cats. Cats are very easy to love. Cats are very popular."
text = text.replaceAll("Cats","Dogs");
text = text.replaceAll("cats","dogs");

document.getElementById("demo").innerHTML = text;
</script>

</body>
</html>

ﺪﻫﺩ ﯽﻣ ﻥﺎﮑﻣﺍ ﺎﻤﺷ ﻪﺑ replaceAll() ﺵﻭﺭ

ﺕﺭﻮﺻ ﻦﯾﺍ ﺮﯿﻏ ﺭﺩ ،ﺩﻮﺷ ﻢﯿﻈﻨﺗ ﺪﯾﺎﺑ (g) ﯽﻧﺎﻬﺟ ﻢﭼﺮﭘ ،ﺖﺳﺍ ﻢﻈﻨﻣ ﺕﺭﺎﺒﻋ ﮏﯾ ﺮﺘﻣﺍﺭﺎﭘ ﺮﮔﺍ

ﻝﺎﺜﻣ

text = text.replaceAll(/Cats/g,"Dogs");
text = text.replaceAll(/cats/g,"dogs");

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The replaceAll() Method</h2>

<p>ES2021 intoduced the string method replaceAll().</p>

<p id="demo"></p>

<script>
let text = "I love cats. Cats are very easy to love. Cats are very popular";
text = text.replaceAll(/Cats/g,"Dogs");
text = text.replaceAll(/cats/g,"dogs");

document.getElementById("demo").innerHTML = text;
</script>

</body>
</html>

ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﻪﺟﻮﺗ

ES2020 ﻪﺘﺷﺭ ﺪﺘﻣ() matchAll ﺩﺮﮐ ﯽﻓﺮﻌﻣ ﺍﺭ.



(_) ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ

ES2021 ﺩﺮﮐ ﺩﺎﺠﯾﺍ ﺩﺍﺪﻋﺍ ﺮﺘﺸﯿﺑ ﯽﯾﺎﻧﺍﻮﺧ ﯼﺍﺮﺑ ﺍﺭ (_) ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ:

ﻝﺎﺜﻣ

const num = 1_000_000_000;

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Numbers</h1>

<p>ES2021 intoduced the numeric separator (_) to make numbers more readable:</p>
<p id="demo"></p>

<script>
const num = 1_000_000_000;
document.getElementById("demo").innerHTML = num;
</script>

</body>
</html>

.ﺖﺳﺍ ﯼﺮﺼﺑ ﻩﺩﺎﻔﺘﺳﺍ ﯼﺍﺮﺑ ﻂﻘﻓ ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ

ﻝﺎﺜﻣ

const num1 = 1_000_000_000;
const num2 = 1000000000;
(num1 === num2); 

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Numbers</h1>

<p>ES2021 intoduced the numeric separator (_) to make numbers more readable:</p>

<p>Is 1_000_000_000 the same as 1000000000?</p>
<p id="demo"></p>

<script>
const num1 = 1_000_000_000;
const num2 = 1000000000;
document.getElementById("demo").innerHTML = (num1 === num2);
</script>

</body>
</html>

:ﺩﺍﺩ ﺭﺍﺮﻗ ﺩﺪﻋ ﮏﯾ ﺯﺍ ﯽﯾﺎﺟ ﺮﻫ ﺭﺩ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ

ﻝﺎﺜﻣ

const num1 = 1_2_3_4_5;

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Numbers</h1>

<p>ES2021 intoduced the numeric separator (_) to make numbers more readable:</p>
<p id="demo"></p>

<script>
const num = 1_2_3_4_5;
document.getElementById("demo").innerHTML = num;
</script>

</body>
</html>

ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﻪﺟﻮﺗ

.ﺖﺴﯿﻧ ﺯﺎﺠﻣ ﺩﺪﻋ ﮏﯾ ﯼﺎﻬﺘﻧﺍ ﺎﯾ ﺍﺪﺘﺑﺍ ﺭﺩ ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ

.ﺪﻧﻮﺷ ﻉﻭﺮﺷ _ ﺎﺑ ﺪﻨﻧﺍﻮﺗ ﯽﻣ ﺎﻫﺮﯿﻐﺘﻣ ﻂﻘﻓ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﺭﺩ

:ﺩﻮﺷ ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ ﻥﺭﺪﻣ ﯼﺎﻫﺮﮔﺭﻭﺮﻣ ﻪﻤﻫ ﺭﺩ 2020 ﻪﯾﻮﻧﺍﮊ ﺯﺍ ﯼﺩﺪﻋ ﻩﺪﻨﻨﮐﺍﺪﺟ

Chrome 75 Edge 79 Firefox 74 Safari 13.1 Opera 67
Jun 2019 Jan 2020 Oct 2019 Sep 2019 Jun 2019

at() ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﯾﺍﺭﺁ

ES2022 ﺩﺮﮐ ﺩﺭﺍﻭ ﺍﺭ ﻪﯾﺍﺭﺁ ﺵﻭﺭ at():

ﺎﻫ ﻝﺎﺜﻣ

:ﺪﯿﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺍﺭ ﺎﻫ ﻩﻮﯿﻣ ﻡﻮﺳ ﺮﺼﻨﻋ

const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits.at(2);

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The at() Method</h2>

<p>The at() method returns an indexed element from an array:</p>

<p id="demo"></p>

<script>
const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits.at(2);

document.getElementById("demo").innerHTML = fruit;
</script>

</body>
</html>

:ﺪﯿﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺍﺭ ﺎﻫ ﻩﻮﯿﻣ ﻡﻮﺳ ﺮﺼﻨﻋ

const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits[2];

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>Bracket Notation</h2>

<p>The bracked notation [] returns an indexed element from an array:</p>

<p id="demo"></p>

<script>
const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits[2];

document.getElementById("demo").innerHTML = fruit;
</script>

</body>
</html>

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻪﯾﺍﺭﺁ ﮏﯾ ﺯﺍ ﺍﺭ ﻩﺪﺷ ﻪﯾﺎﻤﻧ ﺮﺼﻨﻋ ﮏﯾ at()

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ [] ﻥﺎﻤﻫ at(

Chrome 92 Edge 92 Firefox 90 Safari 15.4 Opera 78
Apr 2021 Jul 2021 Jul 2021 Mar 2022 Aug 2021

ﺪﯿﺷﺎﺑ ﻪﺘﺷﺍﺩ ﻪﺟﻮﺗ

.ﺪﺷﺎﺑ ﻪﺘﺷﺍﺩ ﯽﺳﺮﺘﺳﺩ ﻪﺤﻔﺻ ﮏﯾ ﯼﺎﻬﺘﻧﺍ ﺯﺍ ﺮﺻﺎﻨﻋ ﻪﺑ ﺎﺗ ﺪﻨﻫﺩﯽﻣ ﻩﺯﺎﺟﺍ [1-] ﺪﻨﻧﺎﻣ

.ﺩﻮﺷ ﯽﻣ ﻩﺩﺎﻔﺘﺳﺍ ءﺎﯿﺷﺍ ﻭ ﺎﻫ ﻪﯾﺍﺭﺁ ﻪﺑ ﯽﺳﺮﺘﺳﺩ ﯼﺍﺮﺑ [] ﺍﺮﯾﺯ ،ﺖﺴﯿﻧ ﺮﯾﺬﭘ ﻥﺎﮑﻣﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

.ﺪﺷ ﯽﻓﺮﻌﻣ ﻞﮑﺸﻣ ﻦﯾﺍ ﻞﺣ ﯼﺍﺮﺑ ES2022 ﺭﺩ at() ﺵﻭﺭ


at() ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺘﺷﺭ

ES2022 ﯼﺍ ﻪﺘﺷﺭ ﺵﻭﺭ at() ﺩﺮﮐ ﺎﻘﻟﺍ ﺍﺭ:

ﺎﻫ ﻝﺎﺜﻣ

:ﺪﯿﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺍﺭ ﻡﺎﻧ ﻡﻮﺳ ﻑﺮﺣ

const name = "W3Schools";
let letter = name.at(2);

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Strings</h1>
<h2>The at() Method</h2>

<p>The at() method returns an indexed element from a string:</p>

<p id="demo"></p>

<script>
const name = "W3Schools";
let letter = name.at(2);

document.getElementById("demo").innerHTML = letter;
</script>

</body>
</html>

:ﺪﯿﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺍﺭ ﻡﺎﻧ ﻡﻮﺳ ﻑﺮﺣ

const name = "W3Schools";
let letter = name[2];

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Strings</h1>
<h2>Bracket Notation</h2>

<p>The bracked notation [] returns an indexed element from a string:</p>

<p id="demo"></p>

<script>
const name = "W3Schools";
let letter = name[2];

document.getElementById("demo").innerHTML = letter;
</script>

</body>
</html>

.ﺪﻧﺍﺩﺮﮔ ﯽﻣﺮﺑ ﻪﺘﺷﺭ ﮏﯾ ﺯﺍ ﺍﺭ ﻩﺪﺷ ﺲﮐﺪﻨﯾﺍ ﺮﺼﻨﻋ ﮏﯾ at()

.ﺪﻧﺍﺩﺮﮔﯽﻣﺮﺑ ﺍﺭ [] ﻥﺎﻤﻫ at(

Chrome 92 Edge 92 Firefox 90 Safari 15.4 Opera 78
Apr 2021 Jul 2021 Jul 2021 Mar 2022 Aug 2021

تمامی حقوق محفوظ است. © BasicIT.org • 2023-2024