1. Home
  2. Javascript
  3. Class
#javascript#es6

Example of the ES6 class declaration.

class Shape {
    constructor(){
        // Constructor code
    }

    color(){
        // Define shape color
    }

    size(){
        // Define shape size
    }
}

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