1. 程式人生 > >JavaScript 循環語句

JavaScript 循環語句

mce while div 循環語句 rip html document javascrip doctype

<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<title>for與while循環</title>
</head> <body>
<script> //for 循環
for (var a = 1; a <= 5; a++) { document.write(a, "<br/>")
} //while 循環
var n = 1; while (n <= 5) {
document.write(n, "<br/>")
n++;
}
</script> </body>

JavaScript 循環語句