Hard
Either the following code:
function Player(name) {
this.name = name;
this.identity = function() {
console.log('foo');
}
}
Player.identity = function identity() {
console.log('bar');
}
Player.prototype.identity = function identity() {
console.log('baz');
}
let myObj = Player('qux'); // Create a player
myObj.identity();
What will be the logged message?
Author: Jean-marie CléryStatus: PublishedQuestion passed 2035 times
Edit
Similar QuestionsMore questions about Javascript