JavaScript: Lesson 6

Using Functions That Take Two Arguments

When you enter text into the textboxes and press OK, your data is sent to my custom function.
There, both pieces of data are processed. The total due (including tax) and the item you purchased
are displayed in an alert box.

The other functions should look familiar. Remember, when you pass two or more arguments, they
must be passed in the same order as the function expects them. When you create a function that
accepts data passed to it, we say those pieces of data are parameters. When you actually SEND/CALL
the function, we say you are passing arguments to the function.

Also, when you pass primitive type variables (string, number, boolean) to the functions they are passed "BYVALUE". That means a copy of the variable/data you send is passed to the function. This keeps your original value unchanged by the function.

When you pass an object to a function it is passed by REFERENCE. This means that a reference to the
objects location in RAM is passed in. The function then can modify the object as you see fit because it is
"pointing" to its real location in RAM.