Argument Passing

In this lesson we will see how to pass arguments to functions in JavaScript. Let's begin!

When you invoke functions, all arguments, independently of their type, are passed by value. The value passed to an argument is stored in a local variable that has meaning only in the scope of the function.

As soon as the function returns, the local variable goes out of the scope and is discarded. It means that even if you change the value of arguments with the function, only the local copies change, and the original values remain intact.

The Listing below demonstrates this:

Listing: Passing arguments by value to

...
Access this course and 1400+ top-rated courses and projects.