I am struggling with the keyword 'instance'. In Java, I only know how to create the "new" keyword. Now, I'm learning about JavaScript, some author heavily used the word 'instance':
function Foo(){}
var foo = new Foo();
//foo is now an instance of Foo
console.log(foo instanceof Foo ) //=> true
What is the purpose of making foo instanceof Foo
?