Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Foo() {
- var s = 1;
- }
- var a;
- var b;
- Foo.prototype.bar = function() {
- if (!a)
- a = this.baz.bind(this);
- else if (!b)
- b = this.baz.bind(this);
- else
- console.log('checking that baz.bind() === baz.bind(): ' + a === b);
- };
- Foo.prototype.baz = function() {
- return 1;
- };
- var f = new Foo();
- f.bar();
- f.bar();
- f.bar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement