is there a way to check the type of an object in javascript against a custom type? I probably worded that wrong so let me show you what i’m wanting to do:
if(typeof value == "MyClassType")
console.log(true);
can you do this with typeof, instanceof, or anything like that? I’m wanting to throw an error if the user provides a value that’s not a class i’m expecting.
Use the
instanceofoperator:Documentation: msdn, mdn