From af5ba21a5c4bf946a5c707397ad647f48caf132a Mon Sep 17 00:00:00 2001 From: battle0450 Date: Tue, 18 Jul 2017 12:53:31 +0000 Subject: [PATCH] =?UTF-8?q?BMI=20=E8=A8=88=E7=AE=97=E6=A9=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2017-chu-battle0450/demo.js | 21 +++++++++++++++++++++ 2017-chu-battle0450/package.json | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 2017-chu-battle0450/demo.js create mode 100644 2017-chu-battle0450/package.json diff --git a/2017-chu-battle0450/demo.js b/2017-chu-battle0450/demo.js new file mode 100644 index 0000000..60dcc02 --- /dev/null +++ b/2017-chu-battle0450/demo.js @@ -0,0 +1,21 @@ +//黃佳晨 +var getBMI = function(weight, height){ + return weight/((height/100)*(height/100)); + +} +getBMI(65,171); +var BMI = getBMI(65,171); +console.log('BMI: '+BMI); + +var getMessage = function(weight,height) +{ + getBMI(weight,height); + if(BMI<18.5) + console.log('體重過輕'); + else if(BMI<24&&BMI>=18.5) + console.log('正常範圍'); + else if(BMI>=24&&BMI<30) + console.log('過重'); +} + +getMessage(65,171); \ No newline at end of file diff --git a/2017-chu-battle0450/package.json b/2017-chu-battle0450/package.json new file mode 100644 index 0000000..25d5b5e --- /dev/null +++ b/2017-chu-battle0450/package.json @@ -0,0 +1,13 @@ +{ + "name": "ex03", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "node demo.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +}