try catch how it works code example
Example: try/catch
var x = 7, y = 7;try { if(x == y){ throw "errorOne"; }else{ throw "errorTwo"; }} catch(e) { if(e == "errorOne"){ console.log("Same")} if(e == "errorTwo") console.log("Different)}