Https://forum.freecodecamp.org/t/use-class-syntax-to-define-a-constructor-function/196075

Any help, i keep having a reference error after several attempt,
Indicating that vegetable is not define.


// Only change code below this line
class vegetable {
constructor(name) {
  this.name = name;
}
}
// Only change code above this line

const carrot = new Vegetable('carrot');
console.log(carrot.name); // Should display 'carrot'
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36

Challenge: Use class Syntax to Define a Constructor Function

Link to the challenge:

Minor typo, the v needs to be upper case.

You’re right Lego, thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.