⏱ 0:01est. 3 min
Chapter 42- Dangerous Aside (Automatic Semicolon Insertion)
Notes
Semicolons are optional in core js
The syntax parser in js engine injects automatically the semicolon at the end of required syntax
Example 1
function getPerson(){
return
{
firstname:'Tony'
}
}
console.log(getPerson()); //gives error as it adds semicolon after return
Following will work
function getPerson(){
return {
firstname:'Tony'
}
}