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.

enter image description here

Once you have written your multi-line code, you can execute it with the enter image description here 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

enter image description here

Good Luck.

Solution 3:

I recommend this:

  1. Write debugger; and hit Enter, in the console tab
  2. This takes you to the Sources tab; if not, make sure debugger breakpoints are active
  3. Now you can write whatever you want in the Sources tab, which acts like a full IDE with features like newline and indentation
  4. 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.