Friday, November 12, 2010

CoolTuts - JavaScript - Variable

You can create a variable with or without the var statemet.
var strname = some value

Scope of the Variable
  1. When you declare the variable within a function, the variable can only be accessed within that function.
  2. When you declare the variable outside the function, all the functions on your page can access it.
  3. The life time of these variables starts when they are declared, and ends when the page is closed.

No comments:

Post a Comment