JAVASCRIPT HashTable
所属分类:
网络编程 / JavaScript
阅读数:
1228
收藏 0赞 0分享
function Hashtable()
{
this._hash = new Object();
this.add = function(key,value){
if(typeof(key)!="undefined"){
if(this.contains(key)==false){
this._hash[key]=typeof(value)=="undefined"?null:value;
return true;
} else {
return false;
}
} else {
return false;
}
}
this.remove = function(key){delete this._hash[key];}
this.count = function(){var i=0;for(var k in this._hash){i++;} return i;}
this.items = function(key){return this._hash[key];}
this.contains = function(key){ return typeof(this._hash[key])!="undefined";}
this.clear = function(){for(var k in this._hash){delete this._hash[k];}}
}
var a = new Hashtable();
a.add("aa");
a.add("bb",2342);
a.add("bb",2342);
a.remove("aa");
alert(a.count());
alert(a.contains("bb"));
alert(a.contains("aa"));
alert(a.items("bb"));
深入解析Vue 组件命名那些事
本篇文章主要介绍了深入解析Vue 组件命名那些事,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0赞 0分享
jquery版轮播图效果和extend扩展
这篇文章主要为大家详细介绍了jquery版轮播图效果,以及extend扩展的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0赞 0分享
深入理解vue2.0路由如何配置问题
本篇文章主要介绍了vue2.0路由配置问题,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0赞 0分享
查看更多