'let' overrides variables previously defined using 'var'

VERIFIED DUPLICATE of bug 346749

Status

()

Core
JavaScript Engine
VERIFIED DUPLICATE of bug 346749
11 years ago
11 years ago

People

(Reporter: Jan, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

335 bytes, text/html
Details
(Reporter)

Description

11 years ago
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."
(Reporter)

Comment 1

11 years ago
Created attachment 261359 [details]
Test page

Updated

11 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 346749
(Reporter)

Updated

11 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.