/*'typeof' and 'instanceof' isn't a reliable method to find out the object class, so this is a function that does this in a more trustable way.*/functionis(type,obj){varclazz=Object.prototype.toString.call(obj).slice(8,-1);returnobj!==undefined&&obj!==null&&clazz===type;}is('String','test');// trueis('String',newString('test'));// true