页面上让用户输入苹果的个数,每个苹果5块钱,alert打印出用户总共花了多少钱
<!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>
</head>
<body>
</body>
<script>
/*
页面上让用户输入苹果的个数
每个苹果5块钱
alert打印出用户总共花了多少钱
*/
let appnumber= window.prompt("请输入苹果的个数");
let app=5
alert("苹果的个数是"+appnumber+"个,单价5元,总价格为"+appnumber*app);
</script>
</html>