Multiline Code Snippets in the Chrome Developer Tools Console

Chrome Developer Tools Quick Tips

Chrome’s developer console tab is great for playing around to understand or troubleshoot a web application. The other day I wanted to enter more than just a simple one line expression in the console. In this case I wanted to define a whole function across several lines. I wasn’t sure if that was possible. Turns out it is.

Multiline snippets in the console

To enter more than one line without the console evaluating the first line immediately, simply use SHIFT + ENTER at the end of each line. Then when you’re done press ENTER as usual to have the whole snippet evaluated.