Why does the JavaScript need to start with “;”?


JavaScript uses a semi-colon (;) to avoid any confusion in code, especially the beginning of a new line.

Example

You can still use the following to avoid any chaos in the code −

return {
   'var':myVal
}

// using semi-colon;
(function( $ ) {
   //
}

Updated on: 23-Jun-2020

89 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements