Introduction

JavaScript is one of the powerful and popular programming languages, especially in web development. It is most well-known as the scripting language for web pages. JavaScript was invented by Brendan Eich in 1995 and became an ECMA standard in 1997. ECMAScript is the official name of the language. In addition to that, every new version of the language comes with awesome features that make the development process easier for developers.

In this article, we will explore some new features of the JavaScript ECMAScript 2017. Take your coffee and let’s get started.

  1. JavaScript String Padding
  2. JavaScript Object Values
  3. JavaScript Object Entries
  4. JavaScript Async Functions
  5. Object.getOwnPropertyDescriptors( )

1. JavaScript String Padding

ECMAScript 2017 added two string methods: padStartand padEndwhich allows you to add padding at the beginning and at the end of a string. You can have a look at the examples below to understand those methods:

let str = "5";
str = str.padStart(4,0);
// result is 0005

The padStart Method.

let str = "1";
str = str.padEnd(4,0);
// result is 1000

The pad End Method.

You can try that in your browser console if you want.

2. JavaScript Object Values

JavaScript 2017 also introduced the Object.valuesthat returns a single dimension array of the object values. Have a look at the example below:

const person = {
  firstName : "Mehdi",
  lastName : "Aoussiad",
  age : 19,
  eyeColor : "black"
};
console.log(Object.values(person));
// Prints ["Mehdi","Aoussiad",19,"black"]

Object.values in JavaScript.

#javascript #web-development #programming #developer

5 Features of JavaScript ECMAScript 2017 with Practical Examples
8.80 GEEK