Hoisting behaviour of 'const' and 'let'
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Sun Oct 12 11:58:24 PDT 2008
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.
You mean code like this?
(function () {
print(x);
{ const x = 42; }
})();
(calls 'print(undefined)').
What is the point of compatibility with such code?
--
David-Sarah Hopwood
More information about the Es-discuss
mailing list