mardi 4 avril 2017

javascript spread operator for object is not working? Is this expected behavior?

Spread operator(...) for an object is not working as you can see in the below code. Is this expected behavior? try it in jsbin

//var test ={start:'stating',end: 'ending'}; //its not working
var test=['start-value','end-value']; //its working
function display(start,end){
  console.log(start,end);
}
display(...test)

The reason behind asking this question is, I saw the use of spread operator using an object in the below line of code but it's not working for me.

http://ift.tt/2nFmZ4e

Am I missing any configuration to make it work ?.




Aucun commentaire:

Enregistrer un commentaire