Hacker News new | ask | show | jobs
by Someone 5286 days ago
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.
1 comments

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