Number vs Numbers as variable?

Im confused as to why my answer doesnt mark off as green despite getting the correct answer in the console.

//Create the smallNumbers array below const smallNumbers = bigNumbers.map(bigNumbers => { return bigNumbers / 10; })

the codecadamy official answer is

const smallNumbers = bigNumbers.map(num => num/100); console.log(smallNumbers);

but we never even declared someting called num???

Using the same name for your function parameter is a bad idea/practice

num is a parameter, parameters are defined along with the function. the .map method will then call your function and provide arguments/values for your parameters

1 Like

Hi everyone,
I misread the use of iterators and I thought that the parameter had to be identical to the name of the array (since I understood that it should not be the case). But I did some little experiments on my side and got the following results that I can’t figure out:

const helloWorld = "Hello"; const startDiscussion = (helloWorld) => { helloWorld = helloWorld + ". I'm fine"; console.log(helloWorld); } startDiscussion("Yes"); console.log(helloWorld);

When I run the code I don’t get any errors, how is this possible? Yet helloWorld is a const global variable, I shouldn’t be able to reassign it in the function.
And then why when I print helloWorld, is it its old name?
I’m maybe just too curious. Thanks all.

I had the same question. The names seem like a good choice for someone experienced. I’d rather have named it numbersAsArray vs numberAsArgument or something. For total beginners even small stuff like this can start making us feel like we’re in Math class in 1995 where things are implied and you give up learning because you can never seem to keep up with everything implied.