For example, following code prints 1, which means that new line is treated as statement separator:
function f1() {
return 1
2
}
console.log(f1());
However, this example prints 3, which means that new line is ignored:
function f1() {
return 1
+2
}
console.log(f1());
How does Javascript decides when to ignore new line character, and when use it as a statement separator?