JavaScript · Middle · Question 11 of 75

How does obj instanceof Class work?

Explanation

That's why instanceof can give surprising results when prototypes are swapped or for objects from another iframe (they have a different Array.prototype). For arrays, Array.isArray is more reliable.

Further reading

Problem with a question

JavaScript · Middle · question 11

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz