`static` keyword from C/C++ as own closured var declaration

Asen Bozhilov asen.bozhilov at gmail.com
Tue Nov 23 02:12:12 PST 2010


David Herman:

>> // "new" more readable sugar
>> function()
>> {
>>  static x = 1; // hello c/c++
>>
>>  return ++x;
>> }

This would produce incompatibilities with ECMAScript 5 non-strict
code.  The word `static` can be used as an Identifier in ES5
non-strict mode.


More information about the es-discuss mailing list