In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how JavaScript defines array elements". Interested friends may wish to take 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 JavaScript defines array elements.
Define array elements, and finally cannot add commas
Although there is nothing wrong with the syntax of adding a comma after the last value of the array, different browsers may get different results.
Varcolors= [5, 6, 7,]; / / the length of such an array may be 3 or 4.
The correct way to define:
Points= [40,100,1,5,25,10]
Define an object, and finally you cannot add a comma
The wrong way to define:
Websites= {site: "Rookie tutorial", url: "www.runoob.com", like:460,}
The correct way to define:
Websites= {site: "Rookie tutorial", url: "www.runoob.com", like:460}
Undefined is not Null
In JavaScript, null is used for objects and undefined for variables, properties, and methods.
The object can be null only if it is defined, otherwise it is undefined.
If we want to test whether the object exists, an error will be thrown when the object is not defined.
The wrong way to use:
If (myObjective people = "undefined")
The correct way is that we need to first use typeof to detect whether the object is defined:
If (typeofmyObjackers) = "undefined" & & myObjackers are null)
Block scope
JavaScript does not create a new scope in each code block, and the scope of each code block is generally global.
The variable I of the following code returns 10 instead of undefined:
Example
For (var I = 0; I < 10; iTunes +) {
/ / some code
}
Return i
At this point, I believe you have a deeper understanding of "how JavaScript defines array elements". 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.
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.