Skip to main content

Class vs prototype

// es6
class Example {
contructor() {
this.test = 1
}
}

// es7 stage 3
class Example {
test = 1
#privateTest = 2 // private var
static s = 3

contructor() {
}
}

// equal to
Example.prototype.test = 1
Example.s = 3