JS tips:

This statement:

carname=”Volvo”;

will declare the variable carname as a global variable , even if it is executed inside a function.

The Lifetime of JavaScript Variables

The lifetime of JavaScript variables starts when they are declared.

Local variables are deleted when the function is completed.

Global variables are deleted when you close the page.