<!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>Document</title>
<script>
//打印1-100岁
// var num = 1;
// do {
// console.log('你今年'+num+'岁了');
// num++;
// } while (num <= 100);
//计算0-100总和
// var num = 0;
// var sum = 0;
// do {
// sum = sum +num;
// num++;
// } while (num <= 100);
// console.log(sum);
//弹出提示框
do {
var str = prompt('你爱我吗');
} while (str !== '我爱你');
alert('我也爱你');
</script>
</head>
<body>
</body>
</html>
web前端学习JS打印dowhile三个案例
最新推荐文章于 2024-05-06 21:51:47 发布