Closed Bug 377267 Opened 17 years ago Closed 17 years ago

'let' overrides variables previously defined using 'var'

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 346749

People

(Reporter: jan.pieniadz, Unassigned)

Details

Attachments

(1 file)

335 bytes, text/html
Details
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a4pre) Gecko/20070402 Minefield/3.0a4pre
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a4pre) Gecko/2007040204 Minefield/3.0a4pre

'let' overrides variables previously defined using 'var'

Reproducible: Always

Steps to Reproduce:
1. Open attached test page.
Actual Results:  
'42' is displayed instead of global. Javascript code looks like this:

Expected Results:  
There should be 'global' word displayed.

SPECIFICATION REFERENCE:
http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7#Scoping_rules_4 :
"In programs and classes let does not create properties on the global object
like var does; instead, it creates properties in an implicit block created for
the evaluation of statements in those contexts. This essentially means that let
won't override variables previously defined using var."
Attached file Test page
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: