JavaScript Arrays (exercise 8)


#1

Update - I added two additions instead of one which is why the exercise would not let me progress!

Hello all, I am very new to coding (please be gentle!) and am having a problem with the below exercise.

https://www.codecademy.com/courses/learn-javascript-arrays/lessons/arrays/exercises/let-const-arrays?action=resume_content_item&course_redirect=introduction-to-javascript

I followed the instructions (i think!) and the output is correct but the exercise is giving me an error message. I’m not sure if I have missed something?

let condiments = [‘Ketchup’, ‘Mustard’, ‘Soy Sauce’, ‘Sriracha’];
const utensils = [‘Fork’, ‘Knife’, ‘Chopsticks’, ‘Spork’];
condiments.push(‘Mayonnaise’, ‘Hummus’);
console.log(condiments);

//output shows as one would expect:

['Ketchup
‘Mustard’
‘Soy Sauce’
‘Sriracha’
‘Mayonnaise’
‘Hummus’]

But I am receiving the below error message:

did you add an item to the condiments array?

The question asked for the addition to the array to be made by using .push() which is what I think I have done. Is anyone able to advise please? Thank you!


#2

add your favorite condiment to the condiments array using .push().

‘Condiment’ in the singular. Add only one item.


#3

Hi mtf

Many thanks for responding. I need to read the questions a few times before I start posting questions! Appreciate you taking a look.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.