1.

If we have an object r and want to know if it is a Range object, we can write ______________(a) r typeof Range(b) r is Range(c) r equals Range(d) r instanceof RangeThis question was posed to me during an interview.I want to ask this question from Comparison of Core JavaScript versus Frameworks topic in division Caching, Debugging and Animation of JavaScript

Answer»

The correct answer is (d) r instanceof Range

Explanation: To know the range OBJECT r instanceof range is used. The r instanceof Range RETURNS true if r INHERITS from Range.prototype. The instanceof operator does not ACTUALLY check whether r was initialized by the Range CONSTRUCTOR.



Discussion

No Comment Found

Related InterviewSolutions