// Semicolon as a seperator console.log("This is first statement"); console.log("This is second statement");
As per the above code, if you want to write two statements in a single line, then you must add a semicolon between them. Otherwise, it will give an error.
// new line as a seperator console.log("This is first statement") console.log("This is second statement")
If each statement is written in a new line, then you can ignore the semicolon. In this case, a new line character is acting as a separator.
// newline not working as a separater console.log( 2 + 3 + 4)
One line comment
One line comment is two forward-slashes. : //
// This is single line comment. console.log("This is first statement");
Multi line comment
Multi line comments start with /* and ends with */.
/* This is multi line comment. This is second line */ console.log("This is second statement");
In this section, you learn about separator. And about comments and why you should use it.