Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var inputs = {
  2. a: 0,
  3. b: 0,
  4.  
  5. "+": function() {
  6. return this.a += this.b
  7. },
  8.  
  9. "-": function() {
  10. return this.a -= this.b
  11. },
  12.  
  13. "*": function() {
  14. return this.a *= this.b
  15. },
  16.  
  17. "/": function() {
  18. return this.a /= this.b
  19. },
  20.  
  21. out: function(a) {
  22. input_field.innerHTML = a
  23. }
  24. calculator.addEventListener("click", function(event) {
  25. if (event.target.querySelectorAll("input[type='button']")) {
  26. inputs.result(event.target.value)
  27. }
  28. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement