Technically you canthrow an exception (throw an error). The exception can be a JavaScriptString, aNumber, aBooleanor anObject: throw"Too big";// throw a text throw500;// throw a number If you usethrowtogether withtryandcatch, you can control program flow and generate custom error messages...
whereobjectNameis the name of the object to compare toobjectType, andobjectTypeis an object type, such asDateorArray. Useinstanceofwhen you need to confirm the type of an object at runtime. For example, when catching exceptions, you can branch to different exception-handling code depending o...
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.