I understand that a const
value is not meant to be reassigned, however consider DevTools is meant to tweak around values while debugging, I think there should be a quick way to try out values. Let say in app.js
:
const foo = 5;
In the console, I tried re-assigning it in the console foo = 6;
Obviously it does not work (Assignment to constant variable). I have also tried delete(window.foo)
but the value still persist even though the delete
function returns true.
Currently the workaround is using Local Overrides (and have to setup persistent file system) since live-editing won't work (the value is already there and without Local Overrides, the edited value does not survive a reload).
Is there any easier way to quickly change a const
value?
const redeclaration in the console was added in Chrome 92 :)
Careful though - this is only supported across separate REPL scripts.