日期:2014-05-16 浏览次数:20434 次
?
?
?
javascript创建数组三种方式
?
第一种方式:
?
var arr = new Array(); arr[0] = new Array("left1","left2","left3"); arr[1] = new Array("right1","right2","right3"); alert(arr[1][2]);?
?
?
第二种方式:
?
var arr = new Array ( new Array("left1","left2","left3"), new Array("right1","right2","right3") ); alert(arr[1][2]);?
?
?
第三种方式:
?
var arr = [ [{"value":"left1"},{"value":"left2"},{"value":"left3"}], [{"value":"right1"},{"value":"right2"},{"value":"right3"}] ]; alert(arr[1][2].value);?
?
?