//变量声明,方法一:假如 Object 未被扩展
var array = new Object();
//变量声明,方法二:假如 Object 已被扩展
var array;
//赋值,以上两种方法均可
array[‘something’] = ‘yay’;
array[‘somethingelse’] = ‘more’;
//循环
for ( var keyVar in array ) {
alert(array[keyVar]);
}
注意 var keyVar ,不加var 为全局全量,可能引起冲突
No Responses (yet)
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.