Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function one(){
- var foo = (function two(){
- if(true){
- return true; //all good
- }else{
- //how can we break function one here?
- })();
- //extra statements only executed if foo is true
- })();
- ;(function() {
- var foo = (function() { return true })()
- if (!foo) return;
- console.log('reached because foo was true')
- })()
- ;(function() {
- try {
- ;(function() {
- var foo = (function() { throw new Error('fail') })()
- /* only reached if an error wasn't thrown */
- })()
- }
- catch (error) {
- console.log('Something went wrong: ' + error)
- }
- })()
- reached because foo was true
- Something went wrong: Error: fail
Add Comment
Please, Sign In to add comment