javascript - Check if class constructor extends another class -


this question has answer here:

how can check if class constructor extends class, without constructing object? ie constructor reference.

example

class {  }  class b extends {  }  var b = b;  if(typeof b === b) 

you can check of instanceof below.

class {    }    class b extends {    }    class c {    }      console.log(b.prototype instanceof a);  console.log(c.prototype instanceof a);    // instance  var b = new b();    console.log(b instanceof b);  console.log(b instanceof a);  console.log(b instanceof c);


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -