News for hackers. Stuff that matters.
Re:Loyal Opposition to Const, Private, Freeze, Non-Configura... by repsilat on Wednesday November 02, 2011 @08:06PM (#3189518)
If you really need private member variables you can probably whip something up with lambdas, though it might be a little awkward.
Re:Loyal Opposition to Const, Private, Freeze, Non-Configura... by reissbaker on Wednesday November 02, 2011 @08:30PM (#3189571)
It's super easy:

  function A {
    var secret = 0; // <---------- private variable
    this.method = function() {
      alert(secret);
    };
    this.increment = function() {
      secret++;
    };
  }

  a = new A();
  a.increment();
  a.method(); <-------- prints 1
The main problem is just the inefficiency of declaring methods inside constructors.

Edit: Hence, the keyword.