Hi there,
I think the arrays exercise / instructions on step 9 of the arrays part of the JS course is wrong.
The task reads as follows:
You’re in a hurry so you decide to ask a friend to help you with your grocery shopping. You want him to pick up the 'bananas'
, 'coffee beans'
, and 'brown rice'
.
Under the code you added for step 2, use .slice()
to provide your friend with a list of these three things.
Log this part of the list to the console. Unlike the two previous checkpoints, you should do both of these steps in one line.
The solution (according Codecademy) is this:
console.log(groceryList.slice(1, 4));
But the 3 elements in the list have the index number 1, 2 and 3 hence I think the correct statement would be
console.log(groceryList.slice(1, 2, 3));
Or am I totally wrong?