JS-输入身高年龄体重后台输出瘦胖标注

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
 </head>
 <body>
  <script>
		var height = Number(prompt("请输入身高:"));
		var weight = Number(prompt("请输入体重:"));
		var bmi = weight / (height * height);
		bmi > 25 ? console.log("您偏胖!") : 
			bmi < 20 ? console.log("您偏瘦!") : console.log("恭喜您,正好!");
	</script>
 </body>
</html>

posted @ 2018-11-11 20:03  IndustriousHe  阅读(1306)  评论(0编辑  收藏  举报