2つの1次元配列を結合することは2次元配列である.

966 ワード

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>javascript       </title>
<script type="text/javascript">
	function forLoops(){
		var arrays = new Array(" "," "," "," "," "," "," ");
		var colors = new Array("loyal","orange","red","green","black","blue","purple");
			var arr = new Array();
                        //             
			for(var i=0;i<arrays.length;i++){
				arr.push([colors[i],arrays[i]]);	
			}
			document.writeln(arr);
	}
</script>
</head>

<body onload="forLoops()">
</body>
</html>
ソロout put:
loyal, ,orange, ,red, ,green, ,black, ,blue, ,purple,