In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "what does the dot in javascript mean?". The editor shows you the operation process through an actual case. The operation method is simple and fast, and it is practical. I hope this article "what does the dot mean in javascript" can help you solve the problem.
Javascript midpoint "." Meaning: 1, represents the arithmetic decimal point (floating point), such as "2.5"; 2, represents the object properties or methods, such as "obj.a", where the point indicates that an is a property of the obj object.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
The dot "." has two semantics in JavaScript.
Semantic 1. Represents the decimal point (floating point) in arithmetic, such as 2.5
Semantic 2. Properties and methods that represent objects, such as [] .push (2)
There is almost nothing difficult to understand, but the following question is interesting.
/ / how this line of code executes 1.toString ()
The following is found in Firebug
The period here expresses the semantic 1 above, so the period must be followed by a number, and here it is followed by toString.
The solution is simple, such as adding parentheses
(1) toString ()
It can still be written in this way, but it's hard to understand.
1..toString ()
The reason why it works in browsers is that each browser JS engine understands "1..toString ()" as "1.0.toString ()". The first period here is semantic 1, and the second period is semantic 2.
There's an even weirder way to write it, but it's not wrong.
1. ToString (); / / Note that there is a space before the period.
Obviously, the period here is semantic 2, that is, the JS engine ignores the spaces before the dot operator, but in fact, the spaces before and after the dot operator are ignored. As follows
1. There is a space 1 before and after the toString (); / / period. ToString (); / / there are two spaces before and after the period 1.toString (); / / there is a tab1 before the period. There is a tab before and after the toString (); / / period.
The JS engine ignores not only spaces but also tab.
This is the end of the content about "what does the dot in javascript mean?" Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.