Created
November 30, 2017 22:32
-
-
Save marklreyes/736c90cc6b65b7149d5a5152e2c8f8bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://codeburst.io/learn-how-to-handle-javascript-errors-with-try-throw-catch-finally-83b4f9ef8c6f | |
try { | |
let hello = prompt("Type hello"); | |
if (hello !== 'hello'){ | |
throw new Error("Oops, you didn't type hello"); | |
} | |
} | |
catch(e) { | |
alert(e.message); | |
} | |
finally { | |
alert('thanks for playing!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment