In the ES6, if I make a class and create an object of that class, how do I check that the object is that class?
I can\'t just use typeof because the obj
typeof
Just a word of caution, the use of instanceof seems prone to failure for literals of built-in JS classes (e.g. String, Number, etc). In these cases it might be safer to use typeof as follows:
instanceof
String
Number
typeof("foo") === "string";
Refer to this thread for more info.