几个实现。。。
前言
前一段时间忙着找工作,好久没更新,更新几个年前看到的几个实现js,当然面试官有的也问到过几个,没事自己写写还是挺有意思,这次当一个回顾吧。
实现一个new
1 | //new |
实现一个Object.create
1 | //Object.create |
实现一个call
1 | //call |
实现一个apply
1 | //apply |
实现一个bind
1 | //bind |
实现一个promise
1 | //_Promise |
实现一个深拷贝
1 | function _deepCopy(arg){ |
实现一个JSON.stringify
1 | function _jsonStringify(obj) { |
实现一个JSON.parse
1 | //JSON.parse |
实现一个instanceOf
1 | //instanceof |
实现一个防抖
1 | //debounce |
实现一个节流
1 | //Throttling |
实现一个函数柯里化
1 | //curry |
实现一个flat
1 | //flat |