Skip to content

Instantly share code, notes, and snippets.

@karolk
Created November 6, 2012 23:21
Show Gist options
  • Save karolk/4028402 to your computer and use it in GitHub Desktop.
Save karolk/4028402 to your computer and use it in GitHub Desktop.
How instanceof works
function A() {}
var a = new A()
a instanceof A
//true
//swap the prototype
A.prototype = {}
a instanceof A
//false
//instanceof checks if the function prototype is the same as objects __proto__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment