Closed Bug 1537636 Opened 7 years ago Closed 7 years ago

Firefox Developer's edition; cannot clear console of javascript data one entered. Must quit application. https://stackoverflow.com/questions/41752998/how-can-i-clear-the-console-javascript-in-firefox

Categories

(DevTools :: Console, defect)

67 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: redmoonproject, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:67.0) Gecko/20100101 Firefox/67.0

Steps to reproduce:

When writing code in the console, it will not forget declared variables when cleared
let a = 5; for example. One cannot then let a = "hello world";

To clear console data one must quite application and restart.

Actual results:

syntax error

Expected results:

new declared value for the variable. (javascript)

Component: Untriaged → Console
Product: Firefox → DevTools

Hello redmoonproject, thanks for filing an issue.
Though, I think it's not a valid bug.
If you write the following in a script:

let a = 5;
let a = "hello world";

You'll get a similar error that the one you describe, because it's how javascript works.
If you want to be able to redeclare variable, you can use var, or you can create an execution block around your expression so the let variables is not bound to the "global" scope:

{
let a = 5;
}
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.