René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
finally [JavaScript snippet] | ||
function throw_if_2(a) { if (a == 2) { throw "a == 2"; } return a*2; } function pass_on(a) { txt_out('going to pass ' + a); try { throw_if_2(a); } catch (e) { txt_out("caught: " + e); } finally { txt_out('I have finally passed ' + a + ' to throw_if_2'); } } function main() { pass_on(1); txt_out(''); pass_on(2); }
See also other Javascript snippets
|