//----------------------| MohammadShokri "use strict"; // Calculate BMI (weight(kg) / height(m) ^ 2) class Person { constructor(name, weight, height) { // weight(kg) | height(cm) this.name = name; this.weight = weight; this.height = height; } getPersonInfo() { return [this.name, this.weight, this.height]; } calcBMI() { const BMI = this.weight / (this.height / 100) ** 2; let result = ` Calculate BMI : | name : ${this.name} | weight : ${this.weight}kg | height : ${this.height}cm | BMI : ${BMI.toFixed(2)} | `; result = result.replace(/\\s/g, "").replace(/\\|/g, "\\n").trim(); return result; } } let mohammad = new Person("Mohammad", 82, 192); console.log(mohammad.calcBMI()); /* --output CalculateBMI: name:Mohammad weight:82kg height:192cm BMI:22.24 */