const redeclaration error

RESOLVED INCOMPLETE

Status

()

Firefox
Developer Tools: Scratchpad
RESOLVED INCOMPLETE
4 months ago
3 months ago

People

(Reporter: Amit Chawla, Unassigned)

Tracking

54 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 months ago
Created attachment 8879807 [details]
Screen Shot 2017-06-21 at 10.20.01 AM.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170608105825

Steps to reproduce:

const MY_CONST = { 'key': 'value' };
MY_CONST.key = 'other value';


Actual results:

/*
Exception: SyntaxError: redeclaration of const MY_CONST
@Scratchpad/1:1:1
*/


Expected results:

it should change the value of key to 'other value', because as the per the documentation on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types it should change the value (as per the attached screen shot), it is working correctly in chrome console.

Updated

4 months ago
Component: Untriaged → Developer Tools: Scratchpad
what's the exact steps do you follow?
you're typing it in Scratchpad, right?
did you hit "Run" twice?

Scratchpad evaluates entire code in the same environment every time you hit "Run".
possible situation that you get the redeclaration error is the following:
  1. write "const MY_CONST = { 'key': 'value' };"
  2. hit "Run"
  3. write "MY_CONST.key = 'other value';" in the next line
  4. hit "Run"
in that case, "const MY_CONST = { 'key': 'value' };" is evaluated twice, and it results in redeclaration.

if your case isn't above, please describe the detailed steps.
Flags: needinfo?(amitchawla777)
also, if you want console, you can use Web Console.
https://developer.mozilla.org/en-US/docs/Tools/Web_Console
Closing due to lack of response.
Feel free to reopen with more information (asked in comment #1).
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 months ago
Flags: needinfo?(amitchawla777)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.