Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. 'use strict';
  2.  
  3. function calculator() {
  4.  
  5. this.read = function(){
  6. this.a = prompt("a?", 0);
  7. this.b = prompt("b?", 0);
  8. };
  9.  
  10. this.sum - function() {
  11. return this.a + this.b;
  12. };
  13.  
  14. this.mul = function() {
  15. return this.a * this.b;
  16. };
  17. }
  18.  
  19. let calculator = new Calculator();
  20. calculator.read();
  21.  
  22. alert( "Sum" + calculator.sum() );
  23. alert( "Mul" + calculator.mul() );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement