页面框架文件
<!DOCTYPE html>
<html lang="zh-CN">
<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>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
事件文件
let money = 100
while (true) {
let re = +prompt(`
请您选择操作:
1.存钱
2.取钱
3.查看余额
4.退出
`)
if (re === 4) {
break
}
let temp = 0
switch (re) {
case 1:
temp = +prompt('请输入存款金额')
money = money + temp
break
case 2:
temp = +prompt('请输入取款金额')
money = money - temp
break
case 3:
alert(`您的银行卡余额是${money}`)
break
}
}