ASI Guide - Rules for Automatic Semicolon Insertion (ASI) in JavaScript
Learn more advanced front-end and full-stack development at: https://www.fullstackacademy.com
You may have noticed that if you accidentally omit semicolons from your Javascript code, your code still works! Why is that?
When your JavaScript is parsed, there is a mechanism called Automatic Semicolon Insertion (ASI) that conceptually inserts missing semicolons into your code based on certain rules. ASI doesn’t actually insert semicolons into the source code, it’s a set of rules that govern where you can omit semicolons. In this ASI Guide, we cover some of the major rules governing Automatic Semicolon Insertion (ASI), examples of how it can help your code if you choose to omit semicolons, and example's where it is not so helpful.
Watch this video to learn:
- What is Automatic Semicolon Insertion (ASI)
- When you can omit Semicolons
- Why you should understand ASI