Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. function deposito() {
  2. let capacidadMaxima = 200;
  3. let contenido = 100;
  4. return {
  5. llenar: function(litros) {
  6. if(contenido + litros >= capacidadMaxima) {
  7. if(typeof(this.onDepositoLLeno) == 'function') {
  8. this.onDepositoLleno(capacidadMaxima);
  9. }
  10. } else {
  11. contenido = contenido + litros;
  12. }
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement