Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*simulating php static keyword in javascript ( http://jsbin.com/xataqaqevini/1/edit )*/
- function User( name ) {
- this.name = name;
- this.__proto__.count++;
- //User.prototype.count++;
- //Object.getPrototypeOf(this).count++;
- }
- User.prototype.count = 0;
- var ali = new User('ali');
- var abu = new User('abu');
- var adi = new User('adi');
- console.log(User.prototype.count);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement