Skip to content

Way finished week2 HomeWork #25

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
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
27 changes: 27 additions & 0 deletions 2017-每天都被自己帥醒-way.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function getBMI(height, weight) {
var bmi = weight/(height*height);
console.log(bmi);
return bmi;
}

function getMessage(height, weight) {
var bmi = getBMI(height, weight);
var message;
if(bmi < 17.5) {
message = "過輕";
} else if (bmi >= 18.5 && bmi < 24) {
message = "正常範圍";
} else if (bmi >= 24 && bmi < 27) {
message = "過重";
} else if (bmi >= 27 && bmi < 30) {
message = "輕度肥胖";
} else if (bmi >= 30 && bmi < 35) {
message = "中度肥胖";
} else if (bmi >= 35) {
message = "重度肥胖";
}

return message;
}

console.log(getMessage(1.75,80));