Menu:

Recent Entries

Categories

Archives

Links

Blogs
- Dflying's Night
- David's Untitled Life
- Dflying's Blog in Chinese

This blog is hosted by DreamHost!

Syndicate

RSS 0.90
RSS 1.0
RSS 2.0
Atom 0.3

JavaScript Variable Scope

Dflying | 10 March, 2006 17:39

In JavaScript, there's a 'wired' feature that the variable scope is only the function. For example, in the following code:

var i = 1;
{
    var i = 2;
}
alert(i);

You will get 2 alerted. That's really interesting and everyone should pay more attention to.


Posted in JavaScript & AJAX. Comment: (0). Trackbacks:(97). Permalink
«Next post | Previous post»

Referers

Comments

Leave a Reply

Auth Image