Number vs Numbers as variable?

Good morning, I had a question regarding this following example code below. Specifically, is it significant that you used the term number and not numbers in the method’s callback function?

const bigNumbers = => {
return number * 10;

Thank you.

number is the parameter, map will pass each value from the numbers array to the parameter. Thus number is a very good name.

you could even name the parameter bar:

const bigNumbers = => {
   return bar * 10;

bar is not very descriptive, its just to demonstrate what is what.


So in the example they start out by manipulating the array called “numbers,” but then after the arrow function the variable manipulated is just called ‘number’. What am I missing? Does Javascript recognize plurals?


number is a parameter. The map method calls the function for each element in the array and passes the current value to the parameter.


1 Like

Hi there,

Hoping you can help. I am still struggling with why this, for example, works:

const groceries = [“item1”, “item2”, “item3”]

function printGrocery(element){


I understand that for each item in the groceries array the function printGrocery will be executed.
What I just cannot get my head around is why the printGrocery function understands what ‘element’ as a parameter represents. To me it seems like it is inexplicably able to know that element is an item in the array.
I am able to make the code run in all the exercises but I am doing it without a true understanding of what is happening.

I know that my misunderstanding here is pretty fundamental and the explanations already in this thread would be sufficient for most, so your patience and explanations are appreciated.


Array.forEach() iterates its context array and returns nothing. We write the action in the form of a function, or callback. That function is called on each iterated value in the array.

printGrocery() is the callback function written as a standalone object, making it useful to the whole program, not just this one method call.


We pass the function name only, without invoking it (pass by reference). The iterator will invoke it using the internal iteration variable as argument, which is represented in the function parameter by element.

Let’s slip back to a normal for loop to illustrate the abstracted work done by the iterator…

for (let x of array) {

The iteration variable x is the akin to the internal variable to which we earlier alluded.

of is the membership operator that first appeared in ES2015 and quickly took hold as a useful tool in ES6. It works equally well with strings or arrays.

Let’s translate the standalone back into a callback expression…

groceries.forEach(x => console.log(x));

Now we can extract that expression and make it a standalone…

const printGrocery = x => console.log(x)

and now,


Starting to click?

Having a standalone function that can stand in as a callback and as a utility function to the rest of the program has more bang for the buck Let’s make our standalone into a generic function.

const log = x => console.log(x);



log('Math is fun')    // Math is fun