Tell us what’s happening:
this runs normally in the local console code when I don’t use the class syntax and use only constructor function , But when I use the class syntax it logs Undefined , this happens only in the local console, I tried two local console .
but in freecodecamp console works perfectly.
is there difference between es6 class syntax and other constructor function declaration ?
**Your code so far**
class User {
constructor(name) {
this.name = name;
}
}
User.prototype = {
constructor:User,
numLegs: 2,
};
let user = new User("Yahia");
console.log(user.numLegs);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
Challenge: Change the Prototype to a New Object
Link to the challenge: