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

Tell us what’s happening:

auto coder is say map should take in dropdown param There has been no step to declare that variable.

Your code so far

const sortInputArray = (event) => {
  event.preventDefault();

  const inputValues = [...document.getElementsByClassName("values-dropdown")].map(() => {
    inputValues.value;
  });
}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

you are not declaring a variable here.
The lesson wants you to add a parameter of dropdown to your callback function.

here is another example

here is a list of numbers

const numbers = [1,2,3,4]

if I wanted to chain the map method to the numbers array and double their amount, then I can pass in a callback with a parameter of num

const numbers = [1, 2, 3, 4].map(num => num * 2);

num is the parameter name in that example. You need to do something similar for this challenge.

inputValues is an array.

your map’s callback function should have a parameter called dropdown and you should implicity return Number(dropdown.value)

hope that helps

1 Like

That is very helpful ! Thankyou

1 Like

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