Last Updated: January 27, 2022
·
43.67K
· tmaster

Enter multiple lines in Chrome JS console.

Maybe many people already knew this, but just for those who don't.

After typing out the first line, instead of hitting enter, hit shift + enter. This will bring you the next line without executing the code. So when you are done, hit enter, it will execute all the code you just wrote.

Also a well known tip, you can bring up JS console in any tabs in the chrome developer tool by hitting ESC (e.g. Elements, Sources etc.).

2 Responses
Add your response

@damienklinnert Yes, indeed. But I am not sure how long ago, the Chrome JS console did not support this.

over 1 year ago ·

Thanks for useful info. Is there a possible way to reverse this behaviour? I mean, I want to write code using Enter to jump to the next line, and shift+enter to execute?

over 1 year ago ·