/dev tips

(213) Popular tips from 2019

Chrome DevTools: Redeclare let and class statements in the Console Panel

10th January 2020
Redeclare let and class statements in the Console Panel

You can now redclare let and class statements in the Console Panel for easier prototyping and experimenting of JavaScript code.

Previously, if you entered the following in the DevTools Console Panel:

let variable = 1
// Press Enter ⏎

let variable = 2
// Press Enter ⏎

You would see an error message: Uncaught SyntaxError: Identifier 'variable' has already been declared.

DevTools now supports this redeclaration for both let and class statements.

This is currently in Canary and will be in the next Chrome stable release.

Sign up to receive a developer tip, in the form of a gif, in your inbox each week.