1. Home
  2. Javascript
  3. Class

Example of the ES6 class declaration.

#javascript#es6
class Shape {
    constructor(){
        // Constructor code
    }

    color(){
        // Define shape color
    }

    size(){
        // Define shape size
    }
}

var newShape = new Shape();
newShape.color();
copy
Full Javascript cheatsheet