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

JavascriptObject Oriented ProgrammingFront End Technology

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( $ ) {
   //
}
raja
Published on 27-Feb-2018 15:23:20
Advertisements