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' │ // └─────────┴───────────┘