Js in bits – 2(semicolon ;)

Js in bits - 2(semicolon ;)


Learning js should be fun. It’s fun if it’s easy.
I tried my best in writing this, to understand it easily.

semicolon ;

Semicolon is used to execute 2 separate statements on a single line or multiple lines.

JS inserts the semicolon

Image description

Js is intelligent in the absence of semicolon

Image description

JS is confused It assumes the value out of the code execution after the alert should be stored in a variable which is missed out, so it results in error.

Image description

Leave y’r thoughts….



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.