js
非凡编程
这个作者很懒,什么都没留下…
展开
-
如何理解闭包
摘要 本文介绍了闭包的定义,作用,及常见的理解中的误区,并没有引入其他的专业词汇。 定义 闭包对应的英文是closure,下边的定义是来自MDN。 A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access转载 2021-11-10 23:20:01 · 232 阅读 · 0 评论 -
我看到的最明了的js事件循环机制
https://segmentfault.com/a/1190000020889508转载 2021-11-07 23:48:25 · 110 阅读 · 0 评论 -
如何实现js的红绿灯切换
描述 红绿灯循环切换。绿灯2秒,黄灯5秒,红灯3秒,再循环。 素材: const green = () => { console.log(Date.now(),'green') } const yellow= () => { console.log(Date.now(),'yellow') } const red = () => { console.log(Date.now(),'red')原创 2021-08-11 21:09:43 · 1353 阅读 · 0 评论