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" +}