Try and Catch Error handling

JavaScript

(function () {
    //if your not in complete control of the code you should alway use a try and catch
    try{
       var y=20/0;
        
    }catch(err){
        alert("an error occurred please try again later");
        alert(err.message);
    }finally{
         alert("code with in finally will always execute!");   
    }
    
}());