You are creating a custom function. You pass an object named testObj to the function as a
parameter. You do not use inheritance through the functions.
The function must establish whether testObj inherits from another object named parentObj.
You need to ensure that the function performs as required.
Which method or operator should you add to the function?
A.
parentObj.instanceof(testObj)
B.
testObj.isPrototypeOf(parentObj)
C.
testObj.instanceof(parentObj)
D.
parentObj.isPrototypeOf(testObj)
Correct answer is D!
Check here:
1) http://stackoverflow.com/questions/18343545/javascript-isprototypeof-vs-instanceof-usage
2) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf
M is right.
Ans is B
M please Check it again what u had given http://stackoverflow.com/questions/18343545/javascript-isprototypeof-vs-instanceof-usage
which is the answer then? Is anyone 100% sure..
I am confused. which is the correct annswer B or D?
I think that none of the answers is correct.
Based on the articles you linked the right answer would be:
parentObj.prototype.isPrototypeOf(testObj)
Compare M’s linked example with this example:
Here we have: parentObj.isPrototypeOf(testObj)
In M’s link: subProto.isPrototypeOf(sub)
MG is wrong because the question specifically says “You do not use inheritance through the functions.”
M is correct. The answer is D.
Answer is D.
http://stackoverflow.com/questions/27890392/isprototypeof-in-javascript
Answer is D
https://jsfiddle.net/ke28tyyw/
Ans D.
D is the correct answr hence testObj is an object that is passed so B is wrong
The answer is D
B is correct.
prototypeObj.isPrototypeOf(object)
Parameter – object
The object whose prototype chain will be searched.
In this case, parentObj’s prototype chain will be searched.
I think answer is D
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf