In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "how to define the initialization size of JavaScript array", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to define the initialization size of JavaScript array" article.
The JavaScript array can initialize the size; when you use the new operator to call the Array () type function to create the array, you only need to pass a numeric parameter to the Array () function to initialize the array size and define the length of the array, that is, the number of elements it contains.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
JavaScript defines (creates or declares) an array in two ways: constructing an array and an array literal.
When you use the new operator to call a function of type Array (), you can construct a new array.
When you pass a numeric argument to the Array () function, you initialize the size of the array and define the length of the array, that is, the number of elements contained.
Example:
Var arr = new Array (5); / / an array of specified length console.log (arr)
You can see that the initialization array size defines the array length as 5, and there are no array elements in it.
When passing multiple values, you can create a real array.
Var arr = new Array (1, true, "string", [1Jue 2], {x true 1J y string 2}); / / Real array console.log (arr)
The above is the content of this article on "how to define the initialization size of JavaScript array". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.