+ 19
In simple language tell me what you understand in this adding method code for me to underdtand easily?
function person(name, age) { this.name= name; this.age = age; this.yearOfBirth = bornYear; } function bornYear() { return 2016 - this.age; } var p = new person("A", 22); document.write(p.yearOfBirth());
1 Answer
+ 13
you can define object property to be function that is defined outside constructor and you can call that function with property name associated with function, no with function name