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.).