Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Last active September 12, 2018 11:15
Show Gist options
  • Save manekinekko/b9d86e0b154e31e4f08354af2d91f4a6 to your computer and use it in GitHub Desktop.
Save manekinekko/b9d86e0b154e31e4f08354af2d91f4a6 to your computer and use it in GitHub Desktop.
function Foo() {
this.bar = function() {
return this;
}
}
// exemple 1
var foo = new Foo();
console.log(foo); //=> Foo
console.log(foo.bar() instanceof Foo); //=> true
// exemple 2
var foo1 = Foo();
console.log(typeof foo1); //=> undefined
console.log(typeof window.bar); //=> function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment