模拟new实现 function newObject() { let obj = new Object(); let Con = [].shift.apply(arguments) obj.__proto__ = Con.prototype; let res = Con.apply(obj,arguments) return typeof res == "object" ? res : obj; } 模拟instanceOf function instanceOf(left,right…
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…