JavaScript basic grammar rules

Programming language is the language of interaction between man and machine. Our daily contact with Chinese language has its specific rules of syntax and programming language applies. Each computer language has its own grammar rules. Only in accordance with the rules of grammar in order to write the code to meet the requirements. Here we take a look at the JavaScript basic rules of grammar.

 

 

Syntax Rule number one: the implementation of the order from top to bottom


  Following the procedure JavaScript HTML performed line by line in the order document. If the code (such as functions, global variables , etc.) necessary to use the entire HTML document, the best code in the HTML document <head ... <head> tag.


  Syntax Rule number two: case sensitive


  JavaScript strict case sensitive. In other words, when you enter keywords, function names, variables, and other identifiers, you must use the correct case. For example, the variable UserName variable username are two different variables.


  Syntax Rule number three: the semicolon at the end of each row dispensable


  JavaScript language does not require to be a semicolon ";" mark the end of the statement. If no points at the end of the statement, JavaScript is automatically the end of the line as the end of the whole statement. For example, the following two lines of sample code, although the end of the first line does not write a semicolon, but also correct. (Note: when writing JavaScript code, the code in order to ensure rigor, accuracy, preferably at the end of each line of code with a semicolon)
  ( "Learning web alert the front ! Went to")
  Alert ( "learning on the web front end to ")!;


  4, annotation specification


  When using JavaScript, in order to make the code easier to read, you need to? JavaScript codes add some comments. ? The same JavaScript code comments and CSS code Comment, also divided into single-line and multi-line comments, sample code as follows:
  // I am a single line comment
  / *
  I am a multi-line comment 1
  I am a multi-line comment 2
  me is a multi-line comments 3
  * /


  These are the basic rules of grammar to share part of JavaScript, especially in teamwork programming process, focusing standardized code can greatly enhance the efficiency of programming team. If you want to learn JavaScript knowledge systems and front-end development. Directly I am currently working front-end development, if you now want to learn front-end development technology, the process of learning the front end in the entry have met any questions about learning, learning routes, learning efficiency and other aspects, you can apply to my learning distal skirt AC: front: the intermediate 603: 985 last: 993. Which gathered some are self-front-end for beginners, skirt documents and there was I doing front-end technology during this time to sort out some of the front-end study manual, the front face questions, front-end development tools, PDF documents Ebook, if required, can be on their own to get the download .

Guess you like

Origin www.cnblogs.com/TT485480/p/12664760.html