Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Counter() {
- this.count = 0;
- this.increaseCount = function() {
- this.count++;
- }
- this.displayCount = function() {
- console.log(this.count);
- }
- }
- var counter1 = new Counter();
- counter1.increaseCount = function() {
- this.count += 2;
- }
- counter1.increaseCount();
- counter1.displayCount(); // 2
Add Comment
Please, Sign In to add comment