JavaScript Questions and Answers

Question:

Please describe what will be printed out to the screen and why?

Answer

In the first console.log() the printed result will be a text representation of the func obj. 
This is because getTheName is a pointer (reference) to func object and when we try to print the object we actually call the toString() method.
In the second console.log() the printed result will be Miki. This is because we implictly invoke the getMashu() method.

No comments:

Post a Comment