How can I type multi line JavaScript code on macOS Terminal's NodeJS console?

Ian Steven Mancera :

For example, I want to copy and insert multi line code, most that are requiring line breaks

var num = 1;
while (num <= 10)
      { console.log(num);
        num += 2; }

Instead copying or typing this just executes or sends this

var num = 1;

How can I do that on NodeJS console via macOS Terminal? Pressing Return (Enter) quickly execute the code right away even though I want to just insert a new line. Even Shift + Return

I want to do this so I'll save time copy and pasting every line, removing line breaks or copying many lines of JS codes

BadPiggie :

In node console just type .editor and enter.

enter image description here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=405531&siteId=1