算法
linusc
这个作者很懒,什么都没留下…
展开
-
js计算斐波那切数列
function pibonacci(index) { const init = [1]; function convert(arg) { if (Object.is(Number(arg), NaN)) { return 0 } return Number(arg) } for (let ...原创 2018-09-15 20:12:52 · 563 阅读 · 0 评论 -
模拟实现bind方法
function fn(a,b,c){ console.log(a) console.log(b) console.log(c) } Function.prototype._bind = function(context,...bindArgs){ let fn = this.name; context[fn] = this; //fn函数 return (...arg) =>...原创 2018-10-18 15:07:05 · 317 阅读 · 0 评论 -
防抖debounce和节流throttle实现
防抖多用于用户注册校验用户名重复等操作 function debounce(){ let timer = null; return function(){ clearTimeout(timer); timer = setTimeout(()=>{ //do something here console.log('check ok!') },500) ...原创 2018-10-18 15:17:15 · 272 阅读 · 1 评论