Created
January 9, 2013 17:17
-
-
Save aalvesjr/4494946 to your computer and use it in GitHub Desktop.
Acessando propriedades em JS like a boss
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
| "use strict"; | |
| var obj = window | |
| , fun = "alert" | |
| , msg = "Testando coisas estranhas em JS"; | |
| obj[fun](msg); // o mesmo resultado de: window.alert("Testando coisas estranhas em JS") | |
| var obj = window | |
| , fun1 = "console" | |
| , fun2 = "log" | |
| , msg = "Testando coisas estranhas em JS"; | |
| obj[fun1][fun2](msg); // o mesmo resultado de: console.log("Testando coisas estranhas em JS") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment