Help us make DevTools Tips better! Fill out this survey to tell us more about your DevTools habits and frustrations.
Write code on multiple lines in the Console
If you're feeling adventurous and want to write longer pieces of code in the Console to execute more complex things, it can quickly become difficult.
Thankfully, there are a few ways to make your life easier by writing on multiple lines, like you would in a code editor:
Use Shift+Enter to create a new line without executing the expression. This works in all browsers.
Or use Firefox's multiline editor. To do this, click on the Switch to multi-line editor mode button located in the top-right corner of the Console message area (or press Ctrl+B).
Or you can create code snippets in Edge, Chrome, or Safari's Sources tools. The added advantage of this technique is that code snippets are saved on your disk, and therefore can be used even after you've restarted the browser. See Re-use scripts as snippets for more information.