Skip to content
Advertisement

why the getter method goes null when i call in another class?

but in the set method on another class when i got the value is exist,, so i have 3 classes the first class is getter setter class , second is the class to fill the set and the last is class to get the method getter,, but it goes null value…

JavaScript

Advertisement

Answer

Class A

JavaScript

Class B

JavaScript

Basically by using new you’re creating two independent from each other objects!

Advertisement