JS-04-流程控制和循环
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <script> //常规的for,while循环都是一样的 //此处只记录for...in和for循环 var list = [1,2,3]; for(i in list){ console.log(i,list[i]); } var obj = {name:'zhansan',age:18,sex:'nan'} for(i in obj){ console.log(i,obj[i]); } for(var i = 0;i<10;i++){ console.log(i); } </script> </body> </html>
可以的话,记得帮我点个推荐,然后收藏+关注哟