title: Verify an Object's Constructor with instanceof
challengeType: 1
---
## Description
<sectionid='description'>
Anytime a constructor function creates a new object, that object is said to be an <code>instance</code> of its constructor. JavaScript gives a convenient way to verify this with the <code>instanceof</code> operator. <code>instanceof</code> allows you to compare an object to a constructor, returning <code>true</code> or <code>false</code> based on whether or not that object was created with the constructor. Here's an example:
Create a new instance of the <code>House</code> constructor, calling it <code>myHouse</code> and passing a number of bedrooms. Then, use <code>instanceof</code> to verify that it is an instance of <code>House</code>.
</section>
## Tests
<sectionid='tests'>
```yml
- text: <code>myHouse</code> should have a <code>numBedrooms</code> attribute set to a number.
testString: 'assert(typeof myHouse.numBedrooms === ''number'', ''<code>myHouse</code> should have a <code>numBedrooms</code> attribute set to a number.'');'
testString: 'assert(/myHouse\s*instanceof\s*House/.test(code), ''Be sure to verify that <code>myHouse</code> is an instance of <code>House</code> using the <code>instanceof</code> operator.'');'