Name
var — NN 2 IE J1 ECMA 1
Synopsis
A keyword that defines the creation of a new variable. Although the
keyword is optional for global variables (those not declared or
initialized inside a function), it is good form to use this keyword
for each new variable. Using the var
keyword
inside a function makes the variable local to statements inside the
function.
You may simply declare one or more variable names, in which case
their initial values are null
. Or you can also
initialize a new variable with a value.
Example
var a, b, c var myName = "Susan"
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.