Defining properties

ES6 brought in a shorter syntax for assigning object properties to the values of variables that have the same name as the properties.
Traditionally, you would've done this:

var x = 1, y = 2;
var object = {
x: x,
y: y
};
console.log(object.x); //output "1"

But now, you can do it this way:

let x = 1, y = 2;
let object = { x, y };
console.log(object.x); //output "1"
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.166.127