<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JS语法练习3</title>
<script>
var amount = 0;
function bankSystem(behavior,number){
if(behavior="save"){amount=amount+number;return amount;}
if(behavior="withdraw"){amount=amount-number;return amount;}
}
function checkAmount(){
document.write(amount+"<br>");
}
bankSystem("save",1000);
checkAmount();
bankSystem("withdraw",300);
checkAmount();
bankSystem("withdraw",850);
checkAmount();
bankSystem("save",700);
checkAmount();
bankSystem("withdraw",60);
checkAmount();
bankSystem("save",100);
bankSystem("save",200);
bankSystem("withdraw",1000);
bankSystem("save",500);
bankSystem("withdraw",200);
checkAmount();
</script>
</head>
<body>
</body>
</html>
摩诃迦叶
相关分类