There are many situations, such as argument validation, where we'll want to check the class of an object. Because JavaScript is not statically typed, we can't guarantee that a function receives an argument of the correct type before the program starts, and we need to check at runtime.
In this recipe, we'll see how to use the instanceOf operator to check an object's prototype at runtime.