"use strict";
let obj1 = { foo: 'bar', x: 42 };
function abc(...aaa) {
console.log(aaa);
}
abc(obj1)
// log result: [{foo: 'bar', x: 42}]
"use strict";
let obj1 = { foo: 'bar', x: 42 };
function abc(...aaa) {
console.log(aaa);
}
abc(obj1)
// log result: [{foo: 'bar', x: 42}]
So in the above code, obj1 is an object. So I use spread operator in the function definition, and give it an object when invoking the function. why the result is an array with one item of that input object? What is the syntax here? I didn't find any explanation in MDN about spread operator. Please help me explain.