جواب تمرین این جلسه

پرسیده شده
فعالیت 918 روز پیش
دیده شده 347 بار
1
 function Person(namePerson, agePerson, heightPerson,wightPerson) { //constructor name must with begin letter capital(letter Large);
        this.name = namePerson.charAt(0).toUpperCase() + namePerson.substr(1);
        this.age = agePerson;
        this.height = heightPerson;
        this.wight = wightPerson;
        this.sayName = function () {
            return `My name is : ${this.name}`;
        };
        this.bmi = function (){
            return this.wight / ((this.height/100)**2);
        }
        this.print = function (){
            let output =`my name is :${this.name}
                         my age is :${this.age}
                         height is :${this.height}CM
                         wight is :${this.wight}KG
                         BMI is :${this.bmi()}`;
            return output;
        }
    }

    var p1=new Person('mahdi',30 , 170,86);
    console.log(p1.print());
فایل پیوست

Mahdiabedini
Mahdiabedini

20 مهر 00

0
حذف شده

سلام

به جز یک غلط املایی بقیه موارد درسته

فایل پیوست

مهرداد دادخواه

توسط

مهرداد دادخواه

1 آبان 00