I am executing following code
console.log('hello');
console.log('hello 2')
In above code why missing a semicolon does not throw an error?
I am executing following code
console.log('hello');
console.log('hello 2')
In above code why missing a semicolon does not throw an error?
Because that is automatically inserted by compiler. Semicolon is optional in JavaScript and added to maintain code readability and termed as good coding practice. Please note, if two statement are in one line then semicolon is not optional, and you need to put it over there. like below
var i = 0; i++