Friday, 31 May 2019

What does mean key value pair inside the square brackets []?

Lets consider following is my object,

var n = {"aa":"x","dd":'d'};

I am using square bracket in Object.assign it gives the following result. [aa: "x", dd: "d"]. The final code is

var n = {"aa":"x","dd":'d'};
var m = Object.assign([],n);

// result is 
[aa: "x", dd: "d"]

in the console.log __proto__ tells this is Array, if it is array following code giving the, unexpected token error

var v = ["sss":"ddd","ccc":"ddd"]; 

What does mean?

enter image description here



from What does mean key value pair inside the square brackets []?

No comments:

Post a Comment