How can I reset a Firefox Web Console in order to be able to use variables already declared?
console.clear()
will only clear the output. All variables already declared are sticking in memory. I'm trying to get rid of:
Error: "SyntaxError: redeclaration of..."
When testing something, use the same construction you would (well, should) use to prevent code and variables being dropped in the global scope. Use Immediately Invoked Function Expressions (IIFE) and place your code in it. Each IIFE is it's own context, so re-declaring is not a problem.
(function () {
const myConstant = 1;
console.log(myConstant);
}());
Note that Chrome 80 allows redeclaration of const and let. There exists a relevant bug in bugzilla for Firefox.
if refreshing the page will reset the console, then you can use location.reload()
to refresh the page via console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With