Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to express at the end of a javascript statement

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to express at the end of javascript sentence". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to express at the end of the javascript sentence.

Javascript can be expressed in semicolons in the end, but the addition or absence of semicolons depends entirely on personal habits, but for the sake of code stability, semicolon sentences are recommended.

This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.

What did javascript say in the end?

The end of a JavaScript statement can be indicated by a semicolon;.

Adding semicolons or not depends entirely on personal habits, but for the sake of code stability (parsing errors), it is recommended to use semicolon sentences.

JavaScript automatic semicolon rule:

1. When there is a newline character (including a multiline comment with a newline character) and the next token does not match the previous syntax, the semicolon is automatically filled.

two。 When there is}, if the semicolon is missing, the semicolon will be filled.

3. When the program source code ends, if the semicolon is missing, the semicolon will be filled.

Conclusion:

1. Line breaks can completely replace semicolons in return, break, continue, post-increment, and post-decrement statements.

For statements beginning with several keywords of 2.var if do while for continue break return with switch throw try debugger, as well as empty statements, it does not matter whether the previous line is added with a semicolon or not.

3. Where expression statements and function expression statements, not followed by a semicolon is very dangerous, the situation is extremely complex.

4. Sentences that begin with (and] are extremely dangerous without a semicolon in front of them.

At this point, I believe you have a deeper understanding of "how to express at the end of the javascript sentence". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report