Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(name, age, weight, height) {
- let map = {};
- map["name"] = name;
- map["personalInfo"] = {
- age: age,
- weight: weight,
- height: height
- };
- let square = (height / 100) * (height / 100);
- let bmi = Math.round(weight / square);
- map["BMI"] = bmi;
- let status = "";
- if (bmi < 18.5) {
- status = "underweight";
- } else if (bmi < 25) {
- status = "normal";
- } else if (bmi < 30) {
- status = "overweight";
- } else {
- status = "obese";
- }
- map["status"] = status;
- if (map["status"] === "obese") {
- map["recommendation"] = "admission required";
- }
- return map;
- }
Add Comment
Please, Sign In to add comment