Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PersonalBMI(inputArg) {
- let arg = {
- name: inputArg[0],
- personalInfo: {
- age: inputArg[1],
- wight: inputArg[2],
- height: inputArg[3]
- },
- BMI: '',
- status: ''
- };
- arg.BMI = calculate();
- function calculate() {
- let height = arg.personalInfo.height / 100;
- let wight = arg.personalInfo.wight;
- let result = Math.ceil(wight / (height * height));
- return result;
- }
- arg.status = statusChecker(arg.BMI);
- console.log(arg);
- function statusChecker(bmi) {
- if (bmi < 18.5) {
- return 'underweight';
- }
- if (bmi < 25) {
- return 'normal';
- }
- if (bmi < 30) {
- return 'overweight';
- }
- if (bmi >= 30) {
- return 'obese';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment