First, prefaceTonight in the eyes of the people to see the front-end technical experts-He Shijun on the JavaScript sentence should be added semicolon? "The answer, let me once again see Daniel's style, really admire extremely." But pure admiration
Inserted only before, after one or more line breaks, and at the end of program inputThis means that you can only omit semicolons in a row, a block of code, and where a program ends.Which means you can write code like this.function Square (x) {
Although JavaScript is very powerful, the language ' s fundamentals does not have a very steep learning curve. Prior to the explosion of Web applications, JavaScript is thought of a toy language for amateur programmers. Some of JavaScript ' s
JavaScript Each statement ends with a semicolon, but because JavaScript has a semicolon automatic insertion rule, all the different programmers have different habits, some with a semicolon, and some without a semicolon, then whether to add a
Objective
Trust in C # and Java everyone knows that the semicolon is used as a punctuation (eos,end of statement), and must be semicolon, otherwise the compilation will not pass. But JavaScript has an ASI mechanism that allows us to omit semicolons.
Text: The semicolon insertion mechanism in JavaScriptInserted only before, after one or more line breaks, and at the end of program inputThis means that you can only omit semicolons in a row, a block of code, and where a program ends.Which means you
Optional semi-colonAs in some languages,, JSusing semicolons(;)separate the statements.This is important to enhance the readability and cleanliness of your code.:missing delimiter,The end of a statement is the next statement,you seem to be talking
Inserted only before, after one or more line breaks, and at the end of program inputThis means that you can only omit semicolons in a row, a block of code, and where a program ends.Which means you can write code like this.function Square (x) {
A detailed description of the semicolon Insertion Mechanism in JavaScript
This article mainly introduces the semicolon Insertion Mechanism in JavaScript. This article describes the semicolon Insertion Mechanism in various cases in JavaScript. For
The semicolon of JavaScript represents the terminator of the statement, but because JavaScript has a semicolon-inserted rule, it is a very confusing thing, and in general, a newline produces a semicolon, but the reality is not , which means that
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.