Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
JavaScript allows you to store and retrieve individual pieces of data as well as collections of data. Individual pieces of data are managed using variables. Collections of data are managed using arrays. You will learn how to work with both variables and arrays in the sections that follow.
In order to use a variable in a JavaScript, it must be declared (or defined). You can declare a variable explicitly or implicitly. An explicitly declared variable is defined before it is referenced using the var keyword. The following example demonstrates how to explicitly declare a variable.