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

Tell us what’s happening:

I’m stuck in this step, i tried passing “.map(Number((dropdown)=>dropdown.value))” as well as “.map(Number(dropdown.value))” and none of them seem to work

Your code so far

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

/* file: styles.css */

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

const sortInputArray = (event) => {
  event.preventDefault();
  const inputValues = [...document.getElementsByClassName("values-dropdown")].map(Number((dropdown) => dropdown.value));
  console.log(inputValues);
}


// 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/131.0.0.0 Safari/537.36

Challenge Information:

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

remember that map takes a function as argument, right now the argument you have is Number((dropdown) => dropdown.value), which is not a function, is a number (or NaN). Number also doesn’t want a function as argument

1 Like

Ok but why doesn’t “.map(Number(dropdown.value))” work then?
(and where does dropdown.value come from?)

do you mean with the quotes? that is a string, it’s not allowed there.

If you mean Number(dropdown.value), it’s still a number, not a function, you need to pass a function to map

1 Like