Advertisement
nPhoenix

JS Construtor

Feb 12th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Foo = function (callback) {
  2.     var lol = 123;
  3.     this.bar = function () {
  4.         console.log(lol)
  5.     };
  6.     this.text = "se fude";
  7.     callback.call(this);
  8. };
  9.  
  10. Foo.prototype = function () {
  11.     return this;
  12. };
  13.  
  14. new Foo(function () {
  15.     console.log(this);
  16.     this.bar();
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement