Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

ES6: Use class Syntax to Define a Constructor Function

class Vegetable {
  constructor(name) {
    this.name = name;
  }
}
const carrot = new Vegetable('carrot');
 
PREVIOUS NEXT
Tagged: #Use #class #Syntax #Define #Constructor #Function
ADD COMMENT
Topic
Name
6+4 =