JSFiddle - React, Tailwind, and code Playground

by adelura

JavaScript

class PokemonManager {
	constructor (database) {
    	this.pokemons = [];
        this.database = database;
        
    }
    
    addPokemon(pokemon) {
    	this.pokemons.push(pokemon);
        this.database.update({ message: 'Pokemon Added', pokemon });
    }
}

class Database {
	update(event) {
    	console.log("Updating database...");
    }
}

let d = new Database();
let pm = new PokemonManager(d);

pm.addPokemon({ name: 'Pikachu' });