Skip to content

Instantly share code, notes, and snippets.

@machikoyasuda
Created August 29, 2013 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machikoyasuda/6373231 to your computer and use it in GitHub Desktop.
Save machikoyasuda/6373231 to your computer and use it in GitHub Desktop.
A Pen by Machiko Yasuda.
// once we defined the function, it worked:
function myFunction() { }
try {
// test your function here
var n = 3;
if (n==4) {
document.write("N == 4.")
}
else {
throw("Not 4.");
}
// set condition for knowing try-block was satisfied
// document.write("This means the try block function ran.");
} catch(error){
// if try does not work, catch the error here.
document.write("This means we made it to the exception." + error);
} finally {
// alert, console.log, alerts
document.write(" This is the end.");
}
body {
font-family: Helvetica;
font-size: 14px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment