Skip to content

Instantly share code, notes, and snippets.

@konami12
Last active September 2, 2020 00:55
Show Gist options
  • Save konami12/afe21369ed1f62333fefb6c0cdb34bb0 to your computer and use it in GitHub Desktop.
Save konami12/afe21369ed1f62333fefb6c0cdb34bb0 to your computer and use it in GitHub Desktop.
❌ Principio de Responsabilidad Única
class Pokemon {
 #name = ""; 
 #type = ""
 #evolutions = [];
 constructor(name, type, evolutions) {
 this.#name = name;
 this.#type = type;
 this.#evolutions = evolutions;
 }
get name() {
return this.#name;
}
get type() {
return this.#type;
}
get evolutions() {
return this.#evolutions;
}
saveDateDB(pokemon) { ... }
}
// Creamos la instacia de la clase pokemon
const Eevee = new Pokemon("Eevee", "normal", ["Jolteon", "Vaporeon", "Flareon"]);
Eeevee.saveDateDB(Eevee);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment