.ES6 (2015) ﻭ ES5 (2009) :ﺪﻧﺍ ﻩﺪﺷ ﯼﺭﺍﺬﮕﻣﺎﻧ ﺩﺍﺪﻋﺍ ﺎﺑ JS ﯽﻤﯾﺪﻗ ﯼﺎﻫ ﻪﺨﺴﻧ
... ،ECMAScript 2016، 2017، 2018، 2019 :ﺪﻧﻮﺷ ﯽﻣ ﯼﺭﺍﺬﮕﻣﺎﻧ ﻝﺎﺳ ﺱﺎﺳﺍ ﺮﺑ ﺎﻫ ﻪﺨﺴﻧ ،2016 ﻝﺎ
:ﺪﻨﮐ ﯽﻣ ﯽﻓﺮﻌﻣ ﺍﺭ ECMAScript 2017 ﺪﯾﺪﺟ ﯼﺎﻫ ﯽﮔﮋﯾﻭ ﻞﺼﻓ ﻦﯾﺍ
ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺘﺷﺭ ﯼﺪﻨﺑ ﻪﯾﻻ
()ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺷ ﯼﺎﻫ ﯼﺩﻭﺭﻭ
()ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﯽﺷ ﺮﯾﺩﺎﻘﻣ
ﺪﯿﻧﺎﻤﺑ ﺮﻈﺘﻨﻣ ﻭ ﻡﺎﮕﻤﻫﺎﻧ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ
JavaScript Object.getOwnPropertyDescriptors
ECMAScript 2017 ﺩﺮﮐ ﻪﻓﺎﺿﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺑ ﺍﺭ ﻪﺘﺷﺭ ﺵﻭﺭ ﻭﺩ: p
let text = "5";
text = text.padStart(4,0);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The padStart() Method</h2>
<p>The padStart() method pads a string from the start.</p>
<p>It pads the string with another string (multiple times) until it reaches a given length.</p>
<p id="demo"></p>
<script>
let text = "5";
text = text.padStart(4,"0");
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
let text = "5";
text = text.padEnd(4,0);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The padEnd() Method</h2>
<p>The padEnd() method pads a string at the end.</p>
<p>It pads the string with another string (multiple times) until it reaches a given length.</p>
<p id="demo"></p>
<script>
let text = "5";
text = text.padEnd(4,"0");
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
padding ﺩﻮﺷ ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ 2017 ﻞﯾﺭﻭﺁ ﺯﺍ ﻥﺭﺪﻣ ﯼﺎﻫﺮﮔﺭﻭﺮﻣ ﻪﻤﻫ ﺭﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﺘﺷﺭ:
Chrome 57 | Edge 15 | Firefox 48 | Safari 10 | Opera 44 |
Mar 2017 | Apr 2017 | Aug 2016 | Sep 2016 | Mar 2017 |
ECMAScript 2017 ﺪﺘﻣ Object.entries()
ﺩﺮﮐ ﻪﻓﺎﺿﺍ ﺎﯿﺷﺍ
Object.entries()
ﻪﯾﺍﺭﺁﺖﻔﺟ ﺯﺍ ﯼﺍﯽﻣﺮﺑ ﯽﺷ ﮏﯾ
const person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue"
};
let text = Object.entries(person);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Object Methods</h2>
<p>The Object.entries() method returns an array of the key/value pairs in an object:</p>
<p id="demo"></p>
<script>
const person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue"
};
let text = Object.entries(person);
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Object.entries()
ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﺳ ﺍﺭ ﺎﻫ ﻪﻘﻠﺣ ﺭﺩ ءﺎﯿﺷﺍ ﺯﺍ
const fruits = {Bananas:300, Oranges:200, Apples:500};
let text = "";
for (let [fruit, value] of Object.entries(fruits)) {
text += fruit + ": " + value + "<br>";
}
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Object Methods</h2>
<p>Object.entries() makes it simple to use objects in loops:</p>
<p id="demo"></p>
<script>
const fruits = {Bananas:300, Oranges:200, Apples:500};
let text = "";
for (let [fruit, amount] of Object.entries(fruits)) {
text += fruit + ": " + amount + "<br>";
}
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Object.entries()
ﺪﻨﮐ ﯽﻣ ﻩﺩﺎﺳ ﺍﺭ ﺎﻫ ﻪﺸﻘﻧ ﻪﺑ ﺎﯿﺷﺍ ﻞﯾﺪﺒ
const fruits = {Bananas:300, Oranges:200, Apples:500};
const myMap = new Map(Object.entries(fruits));
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Object Methods</h2>
<p>Object.entries() makes it simple to convert Object to Map:</p>
<p id="demo"></p>
<script>
const fruits = {Bananas:300, Oranges:200, Apples:500};
const myMap = new Map(Object.entries(fruits));
document.getElementById("demo").innerHTML = myMap;
</script>
</body>
</html>
Object.entries()
ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ 2017 ﺱﺭﺎﻣ ﺯﺍ ﻥﺭﺪﻣ ﯼﺎﻫﺮﮔ
Chrome 47 | Edge 14 | Firefox 47 | Safari 10.1 | Opera 41 |
Jun 2016 | Aug 2016 | Jun 2016 | Mar 2017 | Oct 2016 |
Object.values()
ﻪﺑﺎﺸﻣ Obje
const person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue"
};
let text = Object.values(person);
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Object Methods</h2>
<p>The Object.values() method returns an array of values from an object:</p>
<p id="demo"></p>
<script>
const person = {
firstName : "John",
lastName : "Doe",
age : 50,
eyeColor : "blue"
};
let text = Object.values(person)
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Object.values()
ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ ﻥﺭﺪﻣ ﯼﺎﻫﺮﮔﺭﻭﺮﻣ ﻪﻤﻫ ﺭﺩ 20
Chrome 54 | Edge 14 | Firefox 47 | Safari 10.1 | Opera 41 |
Oct 2016 | Aug 2016 | Jun 2016 | Mar 2017 | Oct 2016 |
async function myDisplay() {
let myPromise = new Promise(function(myResolve, myReject) {
setTimeout(function() { myResolve("I love You !!"); }, 3000);
});
document.getElementById("demo").innerHTML = await myPromise;
}
myDisplay();
→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript async / await</h2>
<p>Wait 3 seconds (3000 milliseconds) for this page to change.</p>
<h1 id="demo"></h1>
<script>
async function myDisplay() {
let myPromise = new Promise(function(resolve) {
setTimeout(function() {resolve("I love You !!");}, 3000);
});
document.getElementById("demo").innerHTML = await myPromise;
}
myDisplay();
</script>
</body>
</html>
:ﺪﻧﺩﺮﮐ ﯽﻣ ﯽﻧﺎﺒﯿﺘﺸﭘ ﻡﺎﮕﻤﻫ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻊﺑﺍﻮﺗ ﺯﺍ ﻪﮐ ﺪﻧﺩﻮﺑ ﯽﯾﺎﻫﺮﮔﺭﻭﺮﻣ ﻦﯿﻟﻭﺍ ﻡﻭﺮﮐ ﻭ ﺲﮐﺎﻓﺮ
Chrome 55 | Edge 15 | Firefox 52 | Safari 11 | Opera 42 |
Dec 2016 | Apr 2017 | Mar 2017 | Sep 2017 | Dec 2016 |