This article summarizes some basic knowledge of JS arrays for everyone. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Array: Store a set of ordered data
The role of array: Store multiple items at once Data
How to define an array:
1. Constructor defines array: var array name=new Array();
2. Literal Define an array in a quantitative way: var array name=[];
[Related course recommendations: JavaScript video tutorial]
The meaning of the following arrays:
1 2 3 4 5 |
|
Array elements: is the data stored in the array
Array length: is the number of elements in the array
Array index (subscript): Start from 0 and end 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 subscript:Array name[index]
The meaning of the following array:
1 2 3 4 5 6 7 8 9 10 11 |
|
This article comes from the js tutorial column, welcome to learn!
The above is the detailed content of Basic knowledge of JS arrays (summary). For more information, please follow other related articles on the PHP Chinese website!