Sollicitatievraag bij LinkedIn

var X = function(someValue){ this.hello = function(){ return someValue; }; }; X.prototype.test = function(){ return this.someValue; }; var x = new X("hi"); ------ what will the following code return? alert(x.hello()); alert(x.test());

Antwoord op sollicitatievraag

Anoniem

28 jul 2010

alert(x.hello()); -->return "hi" alert(x.test()); --> undefined

9