I was testing Object spread operator
and wrote these code, but actually could not figure out how the object user
is transferred into an Array
. So i want to understand the flow of code. Thanks
const user = {
name:"JohnDoe",
age:25
}
function test(...user){
console.log('isArray ', Array.isArray(user)); // true
console.log(user); // Array [ {…} ]
}
test(user);