Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var inputs = {
- a: 0,
- b: 0,
- "+": function() {
- return this.a += this.b
- },
- "-": function() {
- return this.a -= this.b
- },
- "*": function() {
- return this.a *= this.b
- },
- "/": function() {
- return this.a /= this.b
- },
- out: function(a) {
- input_field.innerHTML = a
- }
- calculator.addEventListener("click", function(event) {
- if (event.target.querySelectorAll("input[type='button']")) {
- inputs.result(event.target.value)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement