In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What is the basic knowledge of JS array, many novices are not very clear about it. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Array: storing an ordered set of data
The role of arrays: storing multiple data at a time
How the array is defined:
1. Constructor definition array: var array name = new Array ()
2. Literal definition array: var array name = []
The meaning of the following array:
Var array name = new Array (); / empty array var array name = new Array (value); / / array definition, length var array name = new Array (value 1, value 2, value 3.); / define array and have multiple data var array names = []; / empty array var array name = [value 1, value 2, value 3]; / / there are three data
Array elements: the data stored in the array
Array length: the number of elements in the array
Array index (subscript): starts at 0 and ends with the length of the array minus 1
Set the element value of the array through the subscript: array name [index] = value
Access the element value of the array through the subscript: array name [index]
The meaning of the following array:
Var arr1=new Array (); / / empty array var arr2=new Array (5); / / an array of length 5, and the value of each data is undefinedvar arr3=new Array (1mai 2mine3); / / an array of 5 fractions in length, var arr4= []; / an empty array var arr5= [1recover2d3]; / / an array of length 3 var arr6= ["red", "blue", "green", 1parentin true]; / / the types of values of elements in the array can be different var arr7= [] / / set the value of the elements of the array arr7 [0] = 10 * arr7 [1] = 20; is it helpful for you to read the above? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.