At times, you will find yourself skipping semicolons somewhere and you'll see that your code still works! This is strictly opposite to what you find in languages such as C or C++. Let us take a look at a scenario where you can get trapped by not using semicolons properly.
Consider this code:
var fn = function (arg) { console.log(arg);} // Semicolon missing// self invoking function(function () { alert(5);})() // semicolon missingfn(7)
Take a good look and guess what possible alerts might be, with their orders as well. When you're ready with your answer, look at the following, the code to which JavaScript compiles (not really, just the code after inserting automatic semicolons):
var fn = function (arg) ...