I just read the MDN page for the ES6 spread syntax, and most of the examples on the page worked, but the last one did not:
var obj = {"key1":"value1"};
function myFunction(x) {
console.log(x); // undefined
}
myFunction(...obj);
var args = [...obj];
console.log(args, args.length) //[] 0
I tried it in both Chrome and Firefox, and I'm running the latest browser versions, so the page says that the code ought to work.
Can anyone tell me what the problem is?