Hoisting behaviour of 'const' and 'let'

Maciej Stachowiak mjs at apple.com
Mon Oct 13 18:04:42 PDT 2008

On Oct 12, 2008, at 8:52 AM, Mike Shaver wrote:

> On Sun, Oct 12, 2008 at 9:29 AM, David-Sarah Hopwood
> <david.hopwood at industrial-designers.co.uk> wrote:
>> - the hoisting behaviour of 'const' should be the same as 'let',
>>  because:
>>   * it doesn't need to hoist for backward compatibility, unlike  
>> 'var';
> Not for compatibility with the standard, but const as implemented in
> at least 2/4 (not sure about JSCore) hoists, I believe.

JavaScriptCore does hoist const declarations (but not initializations)  
to the top of the function.

  - Maciej

More information about the Es-discuss mailing list