JavaScript ?? ?? ?? ?? ? 2?? ??
?? ?? ?? ??
??? ??? "?? ??"???. ??? "??"? ???? ?? ?? ??? ???? ???? ???? ????.
JS??? ?? ???? "??"???.
??? length? ?? ??? ?????. ?: var len = arrObj.length;
length ??? ??? ??? ???? ?? ? ????.
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> var arr = ["濤哥" , "男" , 24, "大專" , "北京科技大學" ]; document.write(arr.length); </script> </head> <body> </body> </html>
2?? ??
? ??? ?????. element ? ??? ?? ???? ? ??? "2?? ??"? ???.
??? 2?? ?? ???:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> //使用[]方式創(chuàng)建一個數(shù)組 var arr = [ [1,2,3,4], [4,5,6,7], [8,9,10,11] ]; document.write(arr); </script> </head> <body> </body> </html>
2?? ??? ????? ? ?? ??? ??? ???? ???. ?, ??? ?? ??????.
2?? ??? ?? ???: ?? ?? ??? ?? ?? ??? ??? []? ??, ? ?? ??? []? 1?? ??? ????, ? ?? ??? []? 2?? ??.