Created
November 30, 2012 01:29
-
-
Save Aeon/4173148 to your computer and use it in GitHub Desktop.
js refactoring...
This file contains hidden or 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
var should_reset = false; | |
if (condition1) { | |
alert(1); | |
}else if (condition2) { | |
alert(2); | |
should_reset = true; | |
}else if (condition3) { | |
alert(3); | |
should_reset = true; | |
}else{ | |
return true; | |
} | |
if(should_reset) { | |
reset(); | |
} |
This file contains hidden or 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
if (condition1) { | |
alert(1); | |
}else if (condition2 || condition3) { | |
if(condition2) { | |
alert(2); | |
} else { | |
alert(3); | |
} | |
reset(); | |
}else{ | |
return true; | |
} |
This file contains hidden or 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
if(condition2 || condition3) { | |
reset(); | |
} | |
if (condition1) { | |
alert(1); | |
}else if (condition2) { | |
alert(2); | |
}else if (condition3) { | |
alert(3); | |
}else{ | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment