Skip to content
Open

BMI #14

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
19 changes: 19 additions & 0 deletions 2017-deadlineclub-ji40709/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//趙子權
function getBMI(height,weight){
var BMI = weight/(height*height);
return BMI;
};

console.log(getBMI(1.7,65));

function getMessage(height,weight){
var BMI = weight/(height*height);
if(BMI<18.5){console.log('體重過輕');}
if(BMI>=18.5 & BMI<24){console.log('BMI為正常範圍');}
if(BMI>=24 & BMI<27){console.log('過重');}
if(BMI>=27 & BMI<30){console.log('輕度肥胖');}
if(BMI>=30 & BMI<35){console.log('中度肥胖');}
if(BMI>=35){console.log('重度肥胖');}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

直接return "要顯示的訊息"就可以囉


console.log(getMessage(1.7,65));
12 changes: 12 additions & 0 deletions 2017-deadlineclub-ji40709/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "package",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node demo.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}