会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
~~Distance
博客园
首页
新随笔
联系
管理
订阅
03 2021 档案
手写源码之 简单实现on emit off
摘要: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,call,aplly
摘要: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)
公告