Classes are the programmatic structures that define a business model.
Example :
We will define here the Client class in JavaScript.
class Client {
constructor(name, city, email) {
this.name = name;
this.city = city;
this.email = email;
this._dt_created = new Date();
}
get name() {
return this.name ;
}
get city() {
return this.city; // novidade aqui! retorna uma nova Data
}
get email() {
return this.email;
}
get dt_created(){
return this._dt_created;
}
}
How to create a object from this class ?
var newClient = new Client("name", "city", "email");
console.log(n1.data);