摘要: Function.prototype.bind=function(ctx,...lastArgs){ let self=this return (...laterArgs)=>self.apply(ctx,lastArgs.concat(laterArgs)) } 阅读全文
posted @ 2019-07-29 23:10 dawn~monster 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1:[...new Set(arr)] Array.from(new Set(arr)) 2: 阅读全文
posted @ 2019-07-29 21:03 dawn~monster 阅读(76) 评论(0) 推荐(0) 编辑
摘要: function deepClone(obj){ if(obj instanceof RegEpx) return new RegEpx(obj) if(obj instanceof Date) return new Date(obj) if(typeof obj !=='object') return obj let arr=Array.isArr... 阅读全文
posted @ 2019-07-29 18:24 dawn~monster 阅读(159) 评论(0) 推荐(0) 编辑
摘要: function New(fn,...args){ let obj={} obj.__proto__=fn.prototype let result=fn.apply(obj,args) if(typeof result==='object'||typeof result==='function'){ return result ... 阅读全文
posted @ 2019-07-29 17:31 dawn~monster 阅读(122) 评论(0) 推荐(0) 编辑