Arguments question

We should not define the arguments before we use them in arguments

Means Why we don’t need to define arguments before using inside the function calling ???

Arguments need not be defined (meaning literal) but any object can be an argument. It’s something being passed into a function so why shouldn’t it be defined?

var oranges = 5;

var costOfOranges = function (oranges) {
    return oranges * 5;


// <-  25

There are two oranges variables, not one. They are completely different variables in different scope, just spelled the same.

1 Like

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