Closed
Bug 361685
Opened 19 years ago
Closed 19 years ago
Let can shadow "var" in a sub-scope but can't shadow "const"
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jruderman, Unassigned)
Details
(Keywords: testcase)
js> f = function() { var x; while(0) { let x; } }
function () {
var x;
while (0) {
let x;
}
}
js> f = function() { const x; while(0) { let x; } }
typein:11: TypeError: redeclaration of const x:
typein:11: f = function() { const x; while(0) { let x; } }
typein:11: .........................................^
Comment 1•19 years ago
|
||
This is intentional. If you shadow a const value, then you're effectively changing its value, which is a Bad Thing (TM). vars don't have the same restriction, so they can be overridden.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•