您当前的位置: 首页 > 

暂无认证

  • 2浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

dom啦 循环索引同步1

发布时间:2020-09-07 23:17:37 ,浏览量:2

<!DOCTYPE html> <html> <head> <title></title> </head> <body> <script type="text/javascript"> /*
    默认情况下是顺序结构, 代码会从上之下的执行, 前面的没执行完后面的不能执行
    默认情况下通过var定义的变量, 只要不是定义在函数中都是全局变量
    */ /*for(var i=0;i<3;i++)//前面的执行完后面的才会执行
   {
	   	function test()
	   	{
	   		console.log(i);
	   	}
   }
   console.log(i);
   test();*/ /*for(var i=0;i<3;i++)
   {
   		function test()
   		{
   			 console.log(i);
   		}
   		test();//每次会执行到它
   }
	*/ /*for(var i=0;i<3;i++)
 {
 	(function test()
 	{
 		console.log(i);
 	})();//立即执行的闭包
 }*/ for(var i = 0; i < 3; i++) { (function test(index) { console.log(index); })(i);//立即执行的闭包 } </script> </body> </html> 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.0474s