Files
ClassContent/历届学生/front-end-team-10/每天课程/2023-02-20/for.html
2024-09-27 02:06:13 +08:00

56 lines
1021 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>
</body>
<script>
// var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// for (var i = 0; i < arr.length; i++) {
// console.log(arr[i]);
// }
// var i = 0;
// while (i < arr.length) {
// console.log(arr[i]);
// i++
// }
// var a = 10
// do {
// console.log(a);
// a++
// } while (a < 13)
// var total = 0;
// for (var i = 1; i<=100;i++) {
// total += i;
// }
// console.log(total);
var html = "1×1=1<br/>";
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= i; j++) {
// 1×1=1<br/>
html += `${j} x ${i} = ${i*j}&nbsp;&nbsp;`
}
html+= "<br/>"
}
document.write(html)
console.log(html);
</script>
</html>