* Adding proper solution for spread operation Use the Spread Operator to Evaluate Arrays In-Place: adding the proper solution for the challenge * made some more changes * Fixed the Solution in es6 class constructor guide Fixed the vegetable solution in Guide: Use class Syntax to Define a Constructor Function
		
			
				
	
	
	
		
			1023 B
		
	
	
	
	
	
	
	
			
		
		
	
	
			1023 B
		
	
	
	
	
	
	
	
title
| title | 
|---|
| Use class Syntax to Define a Constructor Function | 
Use class Syntax to Define a Constructor Function
In this lesson, you are defining the Vegetable object using class syntax.
Hint 1:
Create the class called Vegetable. It will contain the necessary details about the Vegetable object.
Hint 2:
Put a constructor with a parameter called name, and set it to this.name.
Spoiler Alert - Solution Ahead!
Solution:
Spoiler Warning: here is a basic solution to this challenge in case you're stuck.
function makeClass() {
  "use strict";
  /* Alter code below this line */
   class Vegetable {
     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'