Bug 183169
Summary: | ReferenceError on constants within {}-block, unless in strict mode | ||
---|---|---|---|
Product: | WebKit | Reporter: | Maarten Oosterwijk <maarten> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | maarten, ysuzuki |
Priority: | P2 | ||
Version: | Safari Technology Preview | ||
Hardware: | All | ||
OS: | macOS 10.13 |
Maarten Oosterwijk
The following code/syntax throws a ReferenceError
it should be valid es6 where MY_CONST is scoped to the {}-block
{
const MY_CONST = 60000;
function doIt() {
console.log(MY_CONST);
};
doIt();
}
in strict mode it works:
"use strict";
{
const MY_CONST = 60000;
function doIt() {
console.log(MY_CONST);
};
doIt();
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Yusuke Suzuki
*** This bug has been marked as a duplicate of bug 163209 ***