0 votes
in JavaScript by
Which one of the following options is the correct output for the given code of JavaScript?

var person =  

{  

      name: "James",  

getName:function()  

{  

nreturnthis.name;  

}  

}  

varunboundName=person.getName;  

varboundName=unboundName.bind(person);  

document.writeln(boundName());  

a) James

b) compilation error

c) runtime error

d) undefined

1 Answer

0 votes
by

Answer: A

Reason: The "bind()" function mentioned in the above-given code, is used for creating a new function which contains its own set of keywords by default.

Related questions

0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
...