There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
The problem with this exercise is that it does not explicitly specify that chores.pop(); deletes the item, while const removed = chores.pop(); stores it. I had the same problem and I had to experiment for some time with the code to figure it out.
just a little notice, the link for the MDN array documentation is broken, it can’t be “clicked”. you can copy the url and paste it in a new window tho.
I’m kind of confused or maybe its a bug, i don’t know, the .pop() method is supposed to remove the last item of an array, but in this example, the item before the last one was removed (i.e ‘cook dinner’), I console log it to see the item removed, it was the second to the last word ‘cook dinner’ and calling the array again, it removed the last two item [‘cook dinner’, ‘mop floor’]. i’m confuse here.
here is the code:
const chores = [‘wash dishes’, ‘do laundry’, ‘take out trash’, ‘cook dinner’, ‘mop floor’];
so that means, this code; console.log(chores.pop()) is not logging the removed item but also removing another item and logging it to the console. Thank you, I understand better now.