日期:2014-05-16 浏览次数:20345 次
var hashMap = {}; hashMap['key1'] = 'value1'; hashMap['key2'] = 'value2'; hashMap['key3'] = 'value3'; hashMap['key4'] = 'value4'; hashMap['key5'] = 'value5'; hashMap['key6'] = 'value6'; if( 'key2' in hashMap) { alert('existance'); } for(value in hashMap) { alert(value); }
var hashMap = { Set : function(key,value){this[key] = value}, Get : function(key){return this[key]}, Contains : function(key){return this.Get(key) == null?false:true}, Remove : function(key){delete this[key]} }