safari and chrome javascript console multiline
Solution 1:
Shift-Enter on Windows allows multi-line entry where Option-Enter works on Mac.
A more fully featured editor is in the works.
Solution 2:
For Google Chrome
, you can Sources >> Snippets >> + New Snippet
in the Developer Console
.
Once you have written your multi-line code
, you can execute it with the button
or with Ctrl + Enter
as mentioned on the button
.
This is like a text-editor which has a host of keyboard shortcuts
which you can find under Settings >> Shortcuts
under Text Editor
Good Luck.
Solution 3:
I recommend this:
- Write
debugger;
and hit Enter, in the console tab - This takes you to the Sources tab; if not, make sure debugger breakpoints are active
- Now you can write whatever you want in the Sources tab, which acts like a full IDE with features like newline and indentation
- Select any part of your code to run, and right-click, choose
Evaluate in console
Solution 4:
http://code.google.com/p/chromium/issues/detail?id=35487
Not yet.
UPDATE: the status of the issue I linked to is now "fixed".
Solution 5:
Try pressing option (shift on Windows) at the same time as return. Inserts a newline on Mac.