Reputation: 776
Now this may be an odd question, but consider the following:
var A = {
name: "A",
showName: function(){console.log(this.name)}
}
var B = {
name: "B"
}
I now want to call the "showName" function of A as if it was a property of B, meaning it should log "B" to the console. Is there any reasonable way to accomplish this?
Upvotes: 2
Views: 43