Learn Basic Algorithmic Thinking by Building a Number Sorter - Step 12

Tell us what’s happening:

I’m confused on where to position the forEach() method. I passed in num and i as the parameters.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const updateUI = (array = []) => {
  forEach(num, i);
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

Learn Basic Algorithmic Thinking by Building a Number Sorter - Step 12

forEach is a method on an array, so it needs to be called as array.forEach()

I got it, but I’m still getting it wrong.

I’m going to need more information to help. What is the new code? What about the instructions or error message has you stuck?

I wrote the array.forEach(num, i) in the body of the arrow function updateAI. I don’t know how I’m going wrong there.

Please show all of the code and talk about how the error message is confusing

Here it is:

const updateUI = (array = []) => {
  array.forEach(num, i);
}

Don’t forget this part. Talking about code is a critical job skill

The arguments aren’t what the instructions asked for

Now I finally got it. I didn’t read the instructions carefully.

1 Like