Message from JavaScript discussions

September 2020

— Expressive, I would say 🧐

— 

Could it be that the code generates a situation, where age is the same for each person? so where ever I change age it will be the identical value, while

myFather.name= "John"; myMother.name="Jane";

stay disjunct properties?

— Unlikely

— So why the heck was it implemented like that?

— What exactly?

— This line:
this.hasAge = this.hasAge.bind(this);

— Because its a schoolar example for learning, probably

— I'll send you a link to the original code
its not scholar sample.

— Does onload work for other things than window? I tried this but it doesn't seem to work:

var myJS = document.createElement('script');
myJS.type = 'text/javascript';
myJS.src = '/path/to/my.js';
document.querySelector('head').appendChild(myJS);
myJS.onload = someFunction();

Message permanent page

— I believe there is another event for these things

— Https://www.javascripttutorial.net/javascript-dom/javascript-onload/#:~:text=The%20image's%20load%20event,method%20of%20the%20image%20elements.&text=You%20can%20assign%20an%20onload,logo%22%20src%3D%22logo.

Message permanent page

— Works with the eventListener, thanks