Classes in ES6
by greatCar
JavaScript
//https://webapplog.com/es6/
class baseModel {
constructor(options = {}, data = []) { // class constructor
this.name = 'Basex'
this.url = 'http://azat.co/api'
this.data = data
this.options = options
}
getName() { // class method
alert(`Class name: ${this.name}`)
}
}
let x = new baseModel()
x.getName();