I understand that Symbol.hasInstance property can be cutomised to check if an object is an instance of a particular class. But what i don't understand is how this is working ?
Example:
class Animal {
static [Symbol.hasInstance](obj){ // how is this obj being passes here on calling the function below
if(obj.isAnimal) return true
}
}
const a1 = new Animal();
console.log(a1 instanceOf Animal) // false
a1.isAnimal = true
console.log(a1 instanceOf Animal) // true
Question: How is obj being passed to the static function on calling a1 instanceOf Animal