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.).
Written by tmaster
Related protips
2 Responses
@damienklinnert Yes, indeed. But I am not sure how long ago, the Chrome JS console did not support this.
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?
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside