• Variables – Scoping, the scope open where the variable is valid. Real life variables. Ex: Dave’s diner asking for “the usual.” The value at Dave’s diner is the BLT, but will change depending on the scope. Local variable is restricted to a single place. Global variable in a program is a value that is satisfied the same way throughout the program. Initialize, giving a value to the variable at the very first time. • var – keyword is used to create a variable. Ex: var myFavoriteColor = “navy”; or jeep.color = myFavoriteColor; the variable name (jeep.color) is not put in quotes, in order to evaluate it. var myBackgroundColor = yellow”; thus window.document.bgColor = myBackgroundColor; o When a variable contains a value, you can assign that value to the property of an object. • Arrays – An array is an ordered collection of data. Each element of an array is a variable and can hold data of any type. You can use an array to hold related data.
This is the end of the preview. Sign up
access the rest of the document.