-
Notifications
You must be signed in to change notification settings - Fork 29
BMI #30
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
base: master
Are you sure you want to change the base?
BMI #30
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function getBMI(W,H) { | ||
var BMI = W/((H/100)*(H/100)); | ||
return BMI; | ||
} | ||
|
||
getBMI(59,180); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 可以不用這一行歐,這一行只有在網頁檢查時看得到結果,真正要在瀏覽器中顯示結果需要console.log噢 |
||
console.log("BMI: "+getBMI(59,180)); | ||
|
||
function getMESSAGE(W,H) { | ||
var bmi = W/((H/100)*(H/100)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 可以直接取 |
||
if (bmi < 18.5) { | ||
console.log("體重過輕") | ||
} | ||
else if (18.5 <= bmi <= 24){ | ||
console.log("正常範圍") | ||
} | ||
else if (24 <= bmi <= 27){ | ||
console.log("過重") | ||
} | ||
else if (27 <= bmi <= 30){ | ||
console.log("輕度肥胖") | ||
} | ||
else if (30 <= bmi < 35){ | ||
console.log("中度肥胖") | ||
} | ||
else if (35 <= bmi ){ | ||
console.log("重度肥胖") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 每一個判斷都可以直接 |
||
} | ||
} | ||
getMESSAGE(59,180); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 這邊再 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
記得
//你的大名
歐