Consider following code snippet:

function Test() { }
var test = new Test();
Test.prototype.member='World';
var test2 = new Test();

var a = test.member;    // 1
var b = test2.member;   // 2
Which of the following statements are true?

Could you give an explanation why 'a' also contains 'World'? Do added properties in prototype hoist?

2018 Jun 19, 1:58:55 PM

@iliana000, fixed! Thnks)

2016 Jan 20, 5:28:51 PM

contains the value of 'World' - missed A

2016 Jan 15, 7:35:44 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes