Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function deposito() {
- let capacidadMaxima = 200;
- let contenido = 100;
- return {
- llenar: function(litros) {
- if(contenido + litros >= capacidadMaxima) {
- if(typeof(this.onDepositoLLeno) == 'function') {
- this.onDepositoLleno(capacidadMaxima);
- }
- } else {
- contenido = contenido + litros;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement