Closed Bug 1374923 Opened 7 years ago Closed 7 years ago

const redeclaration error

Categories

(DevTools Graveyard :: Scratchpad, defect)

54 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: amitchawla777, Unassigned)

Details

Attachments

(1 file)

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.
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
Closed: 7 years ago
Flags: needinfo?(amitchawla777)
Resolution: --- → INCOMPLETE
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: