lynx   »   [go: up one dir, main page]

Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Basic JavaScript

JS Tutorial JS Syntax JS Variables JS Operators JS If Conditions JS Loops JS Strings JS Numbers JS Functions JS Objects JS Dates JS Arrays JS Sets JS Maps JS Math JS RegExp JS Data Types JS Errors JS Debugging JS Events JS Programming JS References JS UTF-8 Characters JS Versions

JS Advanced

JS Functions JS Objects JS Classes JS Iterations JS Promises JS Modules JS HTML DOM JS Windows JS Web API JS AJAX JS JSON JS jQuery JS Graphics JS Examples JS Objects


ECMAScript 2017


New Features in JavaScript 2017

FeatureDescription
String padStart() Pads the beginning of a string
String padEnd() Pads the end of a string
Object entries() Returns an array of the key/value pairs of an object
Object values() Returns an array of the values of an object
async and await Simplifies the handling of promises
Trailing Commas Allows trailing commas where a comma-separated list of values is accepted
getOwnProperty
Descriptors
Returns an object containing all own property descriptors of an object

Browser Support

JavaScript 2017 is supported in all modern browsers since September 2017:

Chrome
58
Edge
15
Firefox
52
Safari
11
Opera
45
Apr 2017 Apr 2017 Mar 2017 Sep 2017 May 2017

JavaScript String Padding

ECMAScript 2017 added two string methods to JavaScript: padStart() and padEnd() to support padding at the beginning and at the end of a string.

Examples

let text = "5";
text = text.padStart(4,0);
Try it Yourself »
let text = "5";
text = text.padEnd(4,0);
Try it Yourself »

JavaScript Object Entries

ECMAScript 2017 added the Object.entries() method to objects.

Object.entries() returns an array of the key/value pairs in an object:

Example

const person = {
  firstName : "John",
  lastName : "Doe",
  age : 50,
  eyeColor : "blue"
};

let text = Object.entries(person);
Try it Yourself »

Object.entries() makes it simple to use objects in loops:

Example

const fruits = {Bananas:300, Oranges:200, Apples:500};

let text = "";
for (let [fruit, value] of Object.entries(fruits)) {
  text += fruit + ": " + value + "<br>";
}
Try it Yourself »

Object.entries() also makes it simple to convert objects to maps:

Example

const fruits = {Bananas:300, Oranges:200, Apples:500};

const myMap = new Map(Object.entries(fruits));
Try it Yourself »

JavaScript Object Values

Object.values() is similar to Object.entries(), but returns a single dimension array of the object values:

Example

const person = {
  firstName : "John",
  lastName : "Doe",
  age : 50,
  eyeColor : "blue"
};

let text = Object.values(person);
Try it Yourself »


JavaScript Async Functions

Waiting for a Timeout

async function myDisplay() {
  let myPromise = new Promise(function(myResolve, myReject) {
    setTimeout(function() { myResolve("I love You !!"); }, 3000);
  });
  document.getElementById("demo").innerHTML = await myPromise;
}

myDisplay();

Try it Yourself »


JavaScript Trailing Commas

JavaScript allows trailing commas wherever a comma-separated list of values is accepted.

In Array and Object Literals, Function Calls, Parameters, Imports and Exports.

Example

function myFunc(x,,,) {};
const myArr = [1,2,3,4,,,];
const myObj = {fname: John, age:50,,,};


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.

Лучший частный хостинг