function Person(name, age, height, weight) { this.name = name.charAt(0).toUpperCase() + name.substr(1); this.age = age; this.height = height; this.weight = weight; this.sayName = function (){ return "My name is "+ this.name;//$this.name.charAt(0).toUpperCase() + this.name.slice(1); } this.bmi = function(){ return "your bmi is: " + parseInt( this.weight/Math.pow(((this.height)/100),2) ); } } var amir = new Person('amir', 32, 180, 80); console.log(amir.name, amir.bmi());