03 2021 档案

摘要:class Event { constructor() { this.eventObj = {}; } $on(eventName, fn) { if (!this.eventObj[eventName]) { this.eventObj[eventName] = []; } this.eventO 阅读全文
posted @ 2021-03-30 18:58 ~~Distance 阅读(123) 评论(0) 推荐(0)
摘要:bind bind用法fn.bind(thisobj,参数1,参数2,。。。) this.a = 1; var mode = { a: 10, getA: function (...rest) { return rest.reduce((pre, value) => { console.log(pr 阅读全文
posted @ 2021-03-30 18:39 ~~Distance 阅读(90) 评论(0) 推荐(0)
摘要:判断数组的类型为数组,而不是Object arr.constructor == Array instanceof arr == Array Array.isArray() reduce 第一个参数是function,第二个参数可以是数组,可以是数字, reduce(function(only,ite 阅读全文
posted @ 2021-03-11 11:25 ~~Distance 阅读(113) 评论(0) 推荐(0)