JavaScript syntax is the set of rules that define a structured JavaScript. Here are some tips to remember when writing your first JavaScript program.
1. Case Sensitivity: JavaScript is case sensitive i.e., uppercase letters and lower-case letters have different meanings. For example, the word “alert” has a lowercase “a”. So, if we type the word with an uppercase “A”, then the alert box will not be displayed and the JavaScript code won't get executed.
2. Whitespace & Line Break: You can use spaces, tabs, and newlines anywhere in the JavaScript Program. The JavaScript interpreter ignores them. Use tabs & spaces to neatly format or indent your code. It makes the code easy to read & understand.
3. Comments: The JavaScript allows us to add single line comments or Multi line comments.
Single-line comments (//) - Any text between a // and the end of a line treated as a comment.
Multi-line comments (/**/) - These comments may span multiple lines.