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) {
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
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
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
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.
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
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
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) {
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
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
Learning Notes is primarily about documenting some of the things JavaScript needs to pay attention to, and some small details.Optional semi-colonLike many other programming languages, JavaScript uses semicolons (;) separate statements. This is
Inserted only before, after one or more lines, and at the end of program input
That means you can only omit a semicolon in one line, a block of code, and the end of a program.
Which means you can write the following code
Copy Code code as
JS magic Hall: ASI (automatic semicolon insertion mechanism) and Front semicolonI. Preface I will see the frontend Technical Expert of the People's Network in zhihu tonight-He Shijun-should I add points to JavaScript statements? The answer, let me
The semicolon in Javascript indicates the end character of the statement. However, because JavaScript has a semicolon automatic insertion rule, some people think that it is not necessary to write the statement. In general, A line feed produces a
The semicolon of the JavaScript represents the terminator of the statement, but since JavaScript has a semicolon-inserted rule, it is a very confusing thing, and in general, a line break produces a semicolon, but the reality is not , which means
BackgroundWhen writing an auto-execute functionvm.$watch(‘datas‘, function() { console.log(vm.datas);})(function () { console.log(‘test‘);})()An inexplicable error occurred:
Uncaught typeerror:vm. $watch (...) (...) is not a function
No should not, only you like not to like. The fact that JavaScript syntax is c-like does not mean that it is essentially a class of languages, and that all intuitive "of course, semicolons" are conservative and hasty conclusions without deep thought.
[Note] JavaScript coding specifications-comma and semicolon, and javascript semicolon
Do not use a comma before a statement.
// Badvar story = [once, upon, aTime]; // goodvar story = [once, upon, aTime];
Do not include extra commas: this will
Look at the code:
Html:
Copy Code code as follows:
index
1
2
3
4
Index.js content:
Copy Code code as follows:
/*
Author:binarytree
*/
Fill a local reference to a picture
Is it necessary to add a semicolon to the beginning of a function in JS? Should I add a semicolon after the JS statement? Should a semicolon be used after JavaScript braces? JS function in the beginning of the exclamation point, semicolon what does
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.