03 2021 档案
摘要:1.防抖 防抖:在高频触发下,在n秒内只触发一次(非严格)。如果n秒内再次触发,则重新计时 //实现debounce function debounce(fn){ let timer = null //创建一个命名存放定时器返回值 return function (){ clearTimeout(t
阅读全文
摘要:1.简单实现promise //手写实现promise,promiseAll,promiseRace function myPromise(excutor){ this.status = 'pending' //初始状态 this.value = null //存储传入的参数值 this.onRes
阅读全文
摘要:1.实现typeof方法 function myTypeof(obj){ let reg = /\s(\w+)/ //Object.prototype.toString.call()返回[object 类型],根据返回建立匹配规则 let result = reg.exec(Object.proto
阅读全文
摘要:JavaScript常见面试题,原生实现call方法、apply方法和bind方法。这三个方法通常用来改变函数的this指向
阅读全文

浙公网安备 33010602011771号