js是有Dictionary对象的,只是只有在IE浏览器下可以使用. var dic = new ActiveXObject("Scripting.Dictionary"); 但是在其它浏览器下,就需要js实现Dictionary: var Dictionary=function() { this.elements = new Array(); //Length of Dictionary this.length = function () { return this.elements…
js模拟Map对象,实现key---value 根据java中map的属性,实现key----value保存 function Map() { var struct = function (key, value) { this.key = key; this.value = value; } var put = function (key, value) { for (var i = 0; i < this.arr.length; i++) { if (this.arr[i].key === k…