Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, the Javascript model is "you name things with `var`, you mutate things with `=`".

If only it were that simple. It also has "you create thing with `var` and sometimes with `=`", plus it does not have block scope:

    if( true)
    {
       var x = 1;
    }
    // x == 1 here.


Functions define scope. The end. Not hard. One rule.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: