how do I console log the result ["cat", "mouse"] using the ES6 method?
this is my current code and it's not working when I console.log(collectionAnimals)
function collectAnimals(...animalList) { return animalList; } collectAnimals("cat", "mouse"); console.log(collectAnimals)
You need to store the values in a variable..
Here in this line:
collectAnimals("cat", "mouse");
you are not storing it anywhere therefore as soon as that line executes the data formed or created from it, is deleted
So, store it in a variable like this
let x = collectAnimals("cat", "mouse");
console.log(x);
and then print "x"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.