An array of
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, > <title>Document</title> </head> <body> <script> var arr=new Array(5); Arr [index] : arr[0]=10; arr[0]=10; arr[1]=20; arr[2]=30; arr[3]=40; arr[4]=50; console.log(arr); Var arr =,20,30,40,50 [10] the console. The log (arr); // Change the value arr[2]=38; console.log(arr); </script> </body> </html>Copy the code
# traversal number group
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, > <title>Document</title> </head> <body> <script> var arr=[10,20,30,40,50]; for(var n=0; n<arr.length; n++){ document.write(arr[n]+"<br>"); } </script> </body> </html>Copy the code
A character array
<html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, Initial - scale = 1.0 "> < title > Document < / title > < / head > < body > < ul id = nav > < / ul > < script > var arr = [" baidu", "tencent", "ali", "the jingdong"]. var str=""; for(var n=0; n<arr.length; n++){ str=str+"<li>"+arr[n]+"</li>"; } var nav=document.getElementById("nav"); nav.innerHTML=str; </script> </body> </html>Copy the code