var myobject = new Object();

myobject.welkin1 = 'gunther1';

myobject.welkin2 = 'gunther2';

myobject.welkin3 = 'gunther3';

var myarray = new Array('gunther1','gunther2','gunther3');

var content='';

for(var key in myobject){

    content += key+':'+ myobject[key]+'<br/>';

}

for(var key in myarray){

content += key+':'+ myarray[key]+'<br/>';

}

輸出結果:

welkin1: gunther1

welkin2: gunther2

welkin3: gunther3

0 : gunther1

1 : gunther2

2 : gunther3

welkingunther 發表在 痞客邦 PIXNET 留言(0) 人氣()