arrays
[x,...y] = [1,2,3,4,5,6]
[1, 2, 3, 4, 5, 6]
x
1
y
[2, 3, 4, 5, 6]
var x2 =
{name:"herby",amount:23423,happy:true,getStatus:function(){return
this.name + (this.happy?" is happy":" isnt happy" ) }}
/with renaming variable
var {name:newname, getStatus:getit} = x2;
console.log(newname); //herby
console.log(getStatus); // function etc
No comments:
Post a Comment