Skip to content

hw #24

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 4 commits into
base: master
Choose a base branch
from
Open

hw #24

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-hellojs_overflow-james.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function getBMI(height,weight) {
return weight/Math.pow(height,2);
}
function getMessage(height, weight){
var bmi = getBMI(height, weight);
console.log("bmi = " + bmi);
if(bmi < 18.5) {
console.log('體重過輕');
}
else if(18.5 <= bmi && bmi < 24) {
console.log('正常範圍');
}
else if(24<= bmi && bmi < 27) {
console.log('過重');
}
else if(27<= bmi && bmi < 30) {
console.log('輕度肥胖');
}
else if(30<= bmi && bmi < 35) {
console.log('中度肥胖');
}
else if(35<= bmi) {
console.log('重度肥胖');
}
}
//getBMI(1.55,52);
getMessage(1.55,52);