People often talk about JavaScript's nasty ASI (Automatic Semicolon Insertion), and often cite this example...
function a() {
return [
'a',
'b',
'c'
];
}
function b() {
return
[
'a',
'b',
'c'
];
}
console.log(a(), b());
// ["a", "b", "c"] undefined
Is there really a semicolon being inserted after return
in b()
, or does the JavaScript grammar state that the return value must explicitly be stated after it (i.e. no \n
)?