Tell us what’s happening:
what is going wrong with this code?
Your code so far
/* jshint expr: true */
function House(numBedrooms) {
this.numBedrooms = numBedrooms;
}
// Add your code below this line
let myHouse = House(5);
myHouse instanceof House;
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof
Just think about what you need to do when creating a new instance of the object. The answer is in the example.
I want to help me with my code no to find the answer in the example
Alright but remember next time to read the example carefully. Its much more rewarding when you can figure the problem out by yourself…there is nothing wrong with your code just remember what you need to write to create a new instance…new is the only word you forgot at.
new House(5)
/* jshint expr: true */
function House(numBedrooms) {
this.numBedrooms = numBedrooms;
}
// Add your code below this line
var myHouse = new House(3000);
myHouse instanceof House;
This is my new code
1 Like