Tell us what’s happening:
I am not stuck, I just don’t understand how it’s working. Can someone help me?
const sortInputArray = (event) => {
event.preventDefault();
const inputValues = [...document.getElementsByClassName("values-dropdown")];
console.log(inputValues);
console.log(inputValues.map((dropdown) => {
return Number(dropdown.value);
}))
}
The first console.log returns this:
[ { '0': {},
'1': {},
'2': {},
'3': {},
'4': {},
'5': {},
'6': {},
'7': {},
'8': {},
'9': {} },
{ '0': {},
'1': {},
'2': {},
'3': {},
'4': {},
'5': {},
'6': {},
'7': {},
'8': {},
'9': {} },
{ '0': {},
'1': {},
'2': {},
'3': {},
'4': {},
'5': {},
'6': {},
'7': {},
'8': {},
'9': {} },
{ '0': {},
'1': {},
'2': {},
'3': {},
'4': {},
'5': {},
'6': {},
'7': {},
'8': {},
'9': {} },
{ '0': {},
'1': {},
'2': {},
'3': {},
'4': {},
'5': {},
'6': {},
'7': {},
'8': {},
'9': {} } ]
The second console.log returns this:
[ 8, 2, 4, 1, 3 ]
Can someone explain how?
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn Basic Algorithmic Thinking by Building a Number Sorter - Step 7