Hoisting behaviour of 'const' and 'let'

Igor Bukanov igor at mir2.org
Tue Oct 14 04:36:44 PDT 2008

2008/10/13 David-Sarah Hopwood <david.hopwood at industrial-designers.co.uk>:
> This is slightly more complex than I'd hoped, but I think the guarantee
> that it is never possible to see uninitialized values of 'const' or 'let'
> variables is worth it.

What about the functions introduced in the let or const initializers?
Like the following 2 examples, where the first does access the
unitilized value but the second does not.

const x = (function() { return x; })()


var f = null;
const x = (f = function() { return f ? x : null;})()

Regards, Igor

More information about the Es-discuss mailing list