JavaScript-行列
2305 ワード
1.配列の宣言
2.行列を巡回
//
var arr1 = ['1','2','3'];
var arr2 = new Array('1','2','3');
var arr3 = new Array();
arr3[0] = '1';
arr3[1] = '2';
arr3[2] = '3';
// , for-each
var arr4 = new Array();
arr3[' '] = '1';
arr3[' '] = '2';
arr3[' '] = '3';
//
var arr5 = new Array();
arr5[0] = ['1','2','3'];
arr5[1] = ['4','5','6'];
2.行列を巡回
var arr = ['1','2','3'];
for (var i=0; i) {
alert(arr[i]);
}
// for-each
for (var i in arr) {
alert(arr[i]);
}