Arrays Section 8 or 9 Part q

I’m stuck on the first part of part 8. It says to go below the two arrays (Condiments and Utensils) and use .push() to add your favorite condiments to the array and then console log it out. I have the following:

let condiments = ['Ketchup', 'Mustard', 'Soy Sauce', 'Sriracha'];

const utensils = ['Fork', 'Knife', 'Chopsticks', 'Spork'];

condiments.push('BBQ Sauce','Aioli');

Which produces the desired result but I keep getting an X telling me I’ve done something wrong. Maybe just a 2nd pair of eyes would help.

A link to the exercise will be helpful for us to be able to test your code.

1 Like

Below the two existing arrays, add your favorite condiment to the condiments array using .push().

Not the plural. The SCT may be expecting only one condiment.


condiments.push('BBQ Sauce');
1 Like

Oh uh. That makes sense but what a silly thing to get hung up on.

That did it. Thank you.

1 Like

It’s unfortunate, but that is what happens when we teach what to think rather than how to think. Your code is fine (correct syntax) but the SCT is limited. We don’t have a lot of wiggle room when it comes to liberties or incorrect interpretation of the instructions. A minor wrinkle in the big picture.


And true to code the idiosyncrasies of a code can drive the coder crazy
trying to figure out what they are doing wrong :slight_smile:

Here is what I do in Chrome:

  • open a lesson
  • open a new tab
  • navigate new tab to about:blank
  • Ctrl + Shift + j to open JS console
  • copy function from lesson to command line in console
  • enter

Bottom line, keep a sandbox open to test lesson code in the real world. The console lets us see the errors and exceptions, as well as expected output when no errors.

Once we pass a lesson we can still use that environment as a sandbox to test other ideas. Note the outputs to see if they meet expectations.

1 Like

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