欢迎光临成都祈钰瑶科技有限公司网站!祝您生活愉快!
热线电话: 18982081108
✕

成都服务器托管,成都GPU服务器租用,成都高防BGP宽带租用,成都机柜租用托管

JS自定义字典对象-创新互联

创新互联建站不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的网站建设、做网站质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式营销型网站建设需求,让再小的高端网站设计也能产生价值!> <script type="text/javascript" language="javascript"> //自定义字典对象function Dictionary(){ this.data ={}; this.put = function(key,value){ this.data[key] = value; }; this.get = function(key){ return this.data[key]; }; this.remove = function(key){ this.data[key] = null; }; this.isEmpty = function(){ return this.data.length == 0; }; this.size = function(){ return this.data.length; }; } //使用 例子var d = new Dictionary(); d.put("CN",{id:1,name:'df'}); d.put("US", "America"); document.write(d.get("CN").name); document.write(d.get("US")); var dic={}; dic.a=1; dic["b"]={id:1,name:"wqeqweqwewqe"} function get(key){ return dic[key]; } document.write(get("b").name); </script>