0

How did this became '1994'?

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()); I can understand what is function, what is method, object literal, object constructor, properties, but not the logic, help me understand. How did 2016 - 22 = 1994?....... Ohh I understand now, lol haahahaha. I was just confused because of this.age. This is programming, anyway, I'm gonna post it, I just type it now, just sharing now XD

22nd Oct 2021, 1:33 AM
Jonathan P. Jundarino
Jonathan P. Jundarino - avatar
2 Réponses
0
Okay, I'm just gonna ask now, how can I print object "p"?
22nd Oct 2021, 1:40 AM
Jonathan P. Jundarino
Jonathan P. Jundarino - avatar
0
Or the variable p
22nd Oct 2021, 1:40 AM
Jonathan P. Jundarino
Jonathan P. Jundarino - avatar