DEV Community

Avinashd
Avinashd

Posted on

Js in bits - 2(semicolon ;)

Learning js should be fun. It is 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.

Image description

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....

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay