Tell us what’s happening:
I’m not quite sure what is wrong with my code. Every time I run it it says “carrot.name should return carrot.” and I am not sure exactly where it is tripping up.
Your code so far
function makeClass() {
"use strict";
/* Alter code below this line */
class Vegetable {
constructor(Vegetable){
this.Vegetable = Vegetable;
}
}
/* 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 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 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