Created
May 28, 2014 10:10
-
-
Save GuillermoPena/93bd97c72d455bbf50ce to your computer and use it in GitHub Desktop.
NodeJS - Variables with dynamic name
This file contains 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 varName1 = "varName2" | |
global[varName1] = "Hello World" // This is the important line ;) | |
var staticVarName = global[varName1] | |
console.log("Var1: Name/Value : varName1/" + varName1) | |
console.log("Var2: Name/Value : " + varName1 + "/" + global[varName1]) | |
console.log("Static Var: Name/Value : staticVarName/" + staticVarName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment