Guest User

Untitled

a guest
May 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function Counter() {
  2. this.count = 0;
  3. this.increaseCount = function() {
  4. this.count++;
  5. }
  6. this.displayCount = function() {
  7. console.log(this.count);
  8. }
  9. }
  10. var counter1 = new Counter();
  11. counter1.increaseCount = function() {
  12. this.count += 2;
  13. }
  14. counter1.increaseCount();
  15. counter1.displayCount(); // 2
Add Comment
Please, Sign In to add comment