-
-
Save pvdz/5652198 to your computer and use it in GitHub Desktop.
Original example
Rewrite to dynamic var: https://gist.github.com/qfox/5652201
Rewrite to global var: https://gist.github.com/qfox/5652207
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
| // Rewrite to dynamic var: https://gist.github.com/qfox/5652201 | |
| // Rewrite to global var: https://gist.github.com/qfox/5652207 | |
| // original | |
| function start(x){ | |
| var foo = 0; | |
| if (x === 1) foo = 1; | |
| else if (x === 2) foo = 2; | |
| else if (x === 3) foo = 3; | |
| else if (x === 4) foo = 4; | |
| else foo = 5; | |
| return foo; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment