تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۰ شریفی
پاسخ تمرین
جامعه جاوا اسکریپت ایجاد شده در ۱۱ مهر ۱۴۰۱
function Person(name, age, height, weight) {
  this.name = nameUpperCase(name);
  this.age = age;
  this.height = height + "cm";
  this.wight = weight + "kg";
  this.bmi = bmiCalc();
  function nameUpperCase(n) {
    return n.charAt(0).toUpperCase() + n.slice(1);
  }
  function bmiCalc() {
    let bmi = weight / (height / 100) ** 2;
    return bmi.toFixed(2);
  }
}
const person1 = new Person("soroush", 28, 180, 82);
console.table(person1);
// ┌─────────┬───────────┐
// │ (index) │  Values   │
// ├─────────┼───────────┤
// │  name   │ 'Soroush' │
// │   age   │    28     │
// │ height  │  '180cm'  │
// │  wight  │  '82kg'   │
// │   bmi   │  '25.31'  │
// └─────────┴───────────┘