摘要: 原文链接:http://www.cnblogs.com/pssp/p/5189345.html 下面我来说一个闭包的使用场景吧。 没有使用闭包的版本 使用了闭包的版本 评论区: for(var i=0;i<li.length;i++){(function(i){li[i].onclick = fun 阅读全文
posted @ 2017-01-16 13:15 viof7852 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 原文链接:http://www.cnblogs.com/pssp/p/5211637.html 简单看一下区别: //运行完就释放了 function a(){ var num = 10; return function(){ num ++; console.log(num); }}a()(); / 阅读全文
posted @ 2017-01-16 10:20 viof7852 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 原文链接:http://www.cnblogs.com/pssp/p/5769315.html 为什么需要异步?why?来看一段代码。 问题1: for(var i=0;i<100000;i++){ } alert('hello world!!!'); 这段代码的意思是执行100...次后再执行al 阅读全文
posted @ 2017-01-16 10:09 viof7852 阅读(165) 评论(0) 推荐(0) 编辑