01-循环的目的
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> 循环的目的</ title>
< script>
console. log ( '媳妇儿我错了' ) ;
console. log ( '媳妇儿我错了' ) ;
console. log ( '媳妇儿我错了' ) ;
console. log ( '.............................' ) ;
for ( var i = 1 ; i <= 1000 ; i++ ) {
console. log ( '媳妇儿我错了' ) ;
}
</ script>
</ head>
< body>
</ body>
</ html>
02-for循环语法结构
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> for循环语法结构</ title>
< script>
for ( var i = 1 ; i <= 100 ; i++ ) {
console. log ( '你好' ) ;
}
</ script>
</ head>
< body>
</ body>
</ html>
03-for循环执行过程
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> for循环执行过程</ title>
< script>
for ( var i = 1 ; i <= 100 ; i++ ) {
console. log ( '你好' ) ;
}
</ script>
</ head>
< body>
</ body>
</ html>
04-for循环断点调试
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> for循环断点调试</ title>
</ head>
< body>
< h4> 断点调试</ h4>
< p> 断点调试是指自己在程序的某一行设置一个断点,调试时,程序运行到这一行就会停止,然后你一步一步往下调试,调试过程中可以看各个变量当前的值,出错的话,调试到出错的代码行即显示错误,停下</ p>
< h3> 断点调试可以帮我们观察程序的运行过程</ h3>
< P> 浏览器中右键点击检查,找到sources源代码,找到需要调试的文件,在程序的某一行设置断点</ P>
< p> watch:监听,通过watch可以监视变量的值的变化,非常常用</ p>
< p> F11:程序单步执行,让程序一行一行的执行,这个时候,观察watch中变量的值的变化</ p>
</ body>
</ html>
05-for循环执行相同代码
<! DOCTYPE html >
< html lang = " en" >
< head>
< meta charset = " UTF-8" >
< meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> for循环执行相同代码</ title>
< script>
var num = prompt ( '请你输入次数' ) ;
for ( var i = 1 ; i <= num; i++ ) {
console. log ( '媳妇儿我错了' ) ;
}
</ script>
</ head>
< body>
</ body>
</ html>
06-for循环执行不同代码
<! DOCTYPE html >
< html lang = " en" >