Use class Syntax to Define a Constructor Function what?

Tell us what’s happening:

what wrong it’s must be right
???
Your code so far


function makeClass() {
  "use strict";
  /* Alter code below this line */
 class Vegtable {
   constructor(name){
     this.name= name;
   }
 }
  /* Alter code above this line */
  return Vegetable;
}
const Vegetable = makeClass();
const carrot = new Vegetable('carrot');
console.log(carrot.name); // => should be 'carrot'

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function

You have a very significant typo. Look at what the makeClass function is returning (which was the original challenge code) compared to what you wrote.

1 Like