What Is The Syntax Like?
  1. Syntax is very important in JavaScript as in any other language, below are some common mistakes when coding.
  2. In the example to the right the Javascript element is used with the "type" attribute. This attribute is used to indicate the type of scripting language used( in this case type=text/javascript).
  3. The "function" is a reserved word in javascript that is executed when an event occurs. The "NAME", is the name of the function and the "()" brackets are used to pass parameters if needed.
  4. The curly braces "{ }" are used to indicate the beginning and ending of the scripting code.
  5. Finally, the semicolon ";"indicate the end of a JavaScript command.


  • Case-sensitivity - Case is a big issue. JavaScript is case-sensitive, meaning that if you name a variable MyVar, you cannot call it as myvar or mYvAr.
  • Semicolons - Forgetting to put a semicolons at the end of a line of code is a common mistakes.
  • White space
  • Brackets - Forgetting to close your curly braces or code is also common mistakes.
  • Comments
  • Variable and Function Names
  • Reserved Word




JavaScript Syntax