Skip to content

Instantly share code, notes, and snippets.

@nathansearles
Created July 28, 2011 19:48
Show Gist options
  • Save nathansearles/1112383 to your computer and use it in GitHub Desktop.
Save nathansearles/1112383 to your computer and use it in GitHub Desktop.
Return variable from string
var someString = "someArray";
$.someArray =
[
'Item One',
'Item Two',
'Item Three',
'Item Four',
'Item Five',
'Item Six'
];
$.someOtherArray =
[
'Other Item One',
'Other Item Two',
'Other Item Three',
'Other Item Four',
'Other Item Five',
'Other Item Six'
];
console.log($[someString]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment