Created
August 28, 2014 18:58
-
-
Save shamoons/4c8847719b7affa96426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Employee(name) { | |
this.counter = 1; | |
this.name = name; | |
this.getId = function() { return counter++; } | |
} | |
var emp = new Employee("abc"); | |
emp.getId(); | |
emp.getId(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uncaught ReferenceError: counter is not defined