Is multiplier a function or a variable that stores the return of function?

const multiplier = (item, multi) => item * multi;
multiplier(4, 2);

In the above code what is multiplier, is it a variable that stores the return of the arrow function or a function since it is being called multiplier(4, 2); .

const multiplier = (item, multi) => item * multi;
multiplier(4, 2);

I was reading arrow functions when I came across this

const multiplier = function (item, multi) {
  return  item * multi;
};
multiplier(4, 2);

if this is the case.
Can you explain now ?

The latter is known as a function expression. It is similar but has some differences when compared to a declared function.

1 Like

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