for文でループしながら配列を出力する

<p id="abc"></p>

var myfamily = new Array();
	myfamily[0] = "わたる";
	myfamily[1] = "みずき";
	myfamily[2] = "みかん";
	myfamily[3] = "かるび";
	
var def = document.getElementById("abc");

str = "私の家族は、";

for(var i = 0 ; i < myfamily.length ; i++){
	//document.write(myfamily[i] + "<br />");
	str += myfamily[i] + "\n";
}
def.innerHTML = str; // p id="abc"の場所に配列を表示
}

インデックスに戻る