WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 31813
28236
Eval doesn't respect JavaScript's const keyword
https://bugs.webkit.org/show_bug.cgi?id=28236
Summary
Eval doesn't respect JavaScript's const keyword
Joseph Pecoraro
Reported
2009-08-12 15:47:31 PDT
It seems a const variable declared in the Console is just a "var" and can change value. > zzz // ensure it doesn't exist ReferenceError: Can't find variable: zzz > const zzz = 10; undefined > zzz = 5; // should do nothing 5 > zzz 5 I would have expected the result to have been 10, since the constant shouldn't change.
Attachments
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2009-08-12 15:54:30 PDT
Maybe this is actually a problem with eval(): Expected Behavior without eval: javascript:const zza = 10; zza = 5; alert(zza) => 10 Bad Behavior with eval: javascript:alert(eval("const zzb = 10; zzb = 5; zzb")) => 5 How should this bug be reclassified?
Timothy Hatcher
Comment 2
2009-08-12 17:18:14 PDT
Oliver, thoughts?
Oliver Hunt
Comment 3
2009-08-12 17:20:49 PDT
Yeah this is a known bug with eval
Gavin Barraclough
Comment 4
2012-03-07 00:32:49 PST
We should resolved this by implementing ES Harmony block scoped const. *** This bug has been marked as a duplicate of
bug 31813
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug