$ node
// (node auto-detects the end of this command and runs it, as expected)
> JSON.parse('{\
... }');
{}
// (node fails to detect the end of this command and gets "stuck", so use ".break" to return to '>' prompt
> JSON.parse('{\
... "hi": 1\
... '});
...
... .break
>
You have syntax error there ('} should be }').
REPL detects end of statement by the fact that it does not throw syntax error.
So everything works as expected.