Why error in JavaScript while calling function and string on same line without semicolons? [duplicate]

That’s basically a question about language mechanism: why string declaration causes error if no space between function call:

console.log()""
// or
console.log()""

But if we adding line break or semicolons (basic code style rules) it works perfectly fine.

// that will work
console.log(); ""
// this one either
console.log()    
""