Array
An array is a special type of variable that can store a value or store multiple values.
Create an array
When creating an array, declare the array variable, use the keyword VAR, the value of the array is enclosed by a pair of brackets ([]), the values in the array are separated by commas (,), and the values in the array can be numbers, strings, and Boolean values.
Accessing and changing values in an array
The array uses the index to determine the value, and the index is used to get the values in the array when accessing the values in the array.
<! DOCTYPEHtml>
<Htmllang="EN" >
<Metacharset="UTF-8" >
<Title> Array </Title>
</Head>
<Body>
<Script>
var ShoppingCart = [ ' Apple ', "Litchi";
Shoppingcar[0]= document. write ( ":" + shoppingcart[0]);
</SCRIPT>
</BODY>
</HTML>
Test questions
1. How do I create an array?
A: When creating an array, declare the array variable, use the keyword VAR, the value of the array is enclosed by a pair of brackets ([]), the values in the array are separated by commas (,), and the values in the array can be numbers, strings, and Boolean values.
2, the array of subscript is from a few start?
Answer: 0
3, how to access the array?
A: Use the index to get the values in the array.
4, how to modify the value of the array?
For:shoppingCart[0]=‘‘;
5. What can the array store?
A: Number types, String types, and Boolean types
6. Can arrays be stored in an array?
Answer: You can
Javascript&jquery. Arrays