JavaScript Variables and Operators

Local and Global

The final consideration when creating a variable is how long that you want it to continue to exist. Variables can either local or global depending on how they are defined.

Exactly where the definitions make a difference is beyond the scope of this introductory series. For the moment it is sufficient for you to know that using local variables everywhere except where you specifically need a variable to be global reduces the chance of name conflicts between like named variables being used for different purposes by different scripts on the same page.

What We Have Learnt

In this tutorial series we have looked at the basic syntax of the JavaScript language. The nouns and verbs of JavaScript are called variables and operators. We looked at how to define variables, how to name them, and also at some of the basic types of data that they contain. We also looked at the assignment operators used for copying one variable to another as well as the number and text string operators that allow you to do calculations with numbers and basic text manipulations.

go to previous section


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow