Issue metadata
Sign in to add a comment
|
Can't re-declare block-scoped (let/const) global variable in console
Reported by
sophieb...@gmail.com,
Aug 16
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 Steps to reproduce the problem: 1. Run `let x = 1;` in console. 2. Run `let x = 2;` in console. What is the expected behavior? Redeclaring a variable with `let` or `const` is an error in JS, but it would be nice for debugging purposes if this was allowed in top-level statements in the console. In particular, it means you need to manually wrap code blocks in an IIFE when revising them – or switch from let/const to var – in order to avoid this error. What went wrong? Uncaught SyntaxError: Identifier 'x' has already been declared (Same happens with `const`.) Did this work before? No Chrome version: 68.0.3440.106 Channel: stable OS Version: OS X 10.13.4 Flash Version: Perhaps one way to implement this would be to convert all global vars' internal type from let/const to var after each console execution.
,
Aug 16
Oh, this turns out to be a dupe of https://bugs.chromium.org/p/chromium/issues/detail?id=679274.
,
Aug 16
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by l...@chromium.org
, Aug 16Status: Assigned (was: Unconfirmed)