Skip to content

bmi work #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions 2017-Kopoa-losevoid/getBmi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html >

<head>
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="https://production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" />
<link rel="mask-icon" type="" href="https://production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" />
<title>CodePen - bmi-test</title>









</head>

<body translate="no" >




<script>
var weight = 70;
var heigh =1.68;

function getBmi(w, h){
return w/(h*h);
}

console.log(getBmi(weight,heigh));
</script>




</body>
</html>
51 changes: 51 additions & 0 deletions 2017-Kopoa-losevoid/getMessage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<html >

<head>
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="https://production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" />
<link rel="mask-icon" type="" href="https://production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" />
<title>CodePen - getmsg</title>









</head>

<body translate="no" >




<script>
var weight = 55;
var heigh =1.68;
var msg,bmi;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msg變數沒有使用到?

function getMes(w, h){
bmi=w/(h*h);
if(bmi>35)
console.log("重肚肥胖");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這樣是直接輸出,沒有做回傳的動作
題目是要讓函數回傳,所以先return訊息

ps.重「肚」肥胖🤣

else if(bmi>29)
console.log("中度肥胖");
else if(bmi>26)
console.log("輕度防胖");
else if(bmi>23)
console.log("過重");
else if(bmi>18)
console.log("正常");
else
console.log("過瘦");

}
getMes(weight,heigh);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊再將函式回傳的結果log出來

</script>




</body>
</html>