Computer >> Computer tutorials >  >> Programming >> Javascript

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( $ ) {
   //
}