How to reset Firefox console without refreshing the page?

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.