摘要:
function Foo() {...}; let f1 = new Foo(); 我们需要牢记两点:①__proto__和constructor属性是对象所独有的;② prototype属性是函数所独有的,因为函数也是一种对象,所以函数也拥有__proto__和constructor属性。 __p 阅读全文
摘要:
//5、jsonp封装 function jsonpPakeage(obj) { //写入url地址中的函数名称,动态创建 var callbackName = "fn"+Math.random().toString().split("\.")[1]; //创建一个script标签 var scri 阅读全文
摘要:
var event = { items: {}, on: function (type, fn) { if (!this.items[type]) { this.items[type] = [] } this.items[type].push(fn) }, emit: function (type) 阅读全文
摘要:
快排算法: let quickSort = function (arr) { if (arr.length < 2) return arr let midValue = arr.splice(0, 1), left = [], right = [] arr.forEach(el => { el > 阅读全文