Skip to content

bmihw #23

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
19 changes: 19 additions & 0 deletions bmi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//吳思嬋

var height=163;
var weight=56;

function getBMI(hei,wei){
return wei/((hei*hei)/10000);
}

function getMessage(hei,wei){
var a=getBMI(hei,wei);
if(a<18.5)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 "要顯示的訊息"就好歐,要return才有符合作業的要求"回傳"

else if(a<=24)console.log("正常");
else if(a<=30) console.log("輕度胖");
else if(a<=35)console.log("中度胖");
else console.log("重度胖");

}
getMessage(height,weight);
Copy link

Choose a reason for hiding this comment

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

還要印出getBMI的結果噢