重新认识javascript的settimeout和异步
摘要:
自己想做一个延时程序,做了一下程序:var start=+new Date();var end=+new Date();while(end-start<3000)//3s{ end=null; end=+new Date();}感觉有点浪费资源,一直在while,所以想到了是否可以用setTimeout。。这就引出了setTimeout的深究。。写出了下面的程序。。var start=+new Date();var end=+new Date(); ~function(){ setTimeout(function(){ end=null; if(en... 阅读全文
posted @ 2011-10-19 20:59 G.N&K 阅读(1446) 评论(0) 推荐(0) 编辑