[Project_owners] Javascript question

Rod Whiteley rod.whiteley at gmail.com
Sun Jul 2 10:41:28 EDT 2006


On 01-07-2006 14:55, Eric H. Jung wrote:
> for (var i=0,j="foo";i<5; i++) {dump(i);}
> dump(j);

What breaks?  And what does 'everything "global"' mean?

The var creates both i and j in the current scope.  So if your code is 
global code, both i and j are global; if your code is function code, 
both i and j are local.  In JavaScript, local always means local to a 
function--there is no other kind of local.

-- 
Rod Whiteley


More information about the Project_owners mailing list