function Person(name, age, height, weight, sex, hairColor, BMI) {
this.name = name;
this.age = age;
this.height = function () {
return height / 100;
};
this.weight = weight;
this.sex = sex;
this.hairColor = hairColor;
this.sayName = function () {
return 'Your name is ' + nameUpperCase(this.name);
}
}
function nameUpperCase(str) {
return str[0].toUpperCase() + str.slice(1);
}
let x = new Person(prompt("What's your name?"), prompt('How old are you ?'), prompt("How tall are you ?"), prompt("What's your weight ?"), prompt("What's your sex ?"), prompt("What's your hair color ?"));
console.log(x.sayName(), ` ,you're ${x.age} years old,`, `you're height is ${x.height() + "m"},`, `you're weight is ${x.weight},`, `you're sex is ${x.sex},`, `you're color is ${x.hairColor}`);
let heiGht = x.height();
let weiGht = x.weight;
console.log("your height is : " + heiGht + " m" );
console.log("your weight is : " + weiGht + " kg" );
let BMI = Math.ceil(weiGht / Math.pow(heiGht,2));
console.log("you're BMI is : " + BMI );