Skip to content Skip to sidebar Skip to footer

Double String Variable Name (javascript)

I know there are other questions similar to this, but I feel as if they don't answer my question. I would basically like to make Dynamic Variable Names. Let me give you an example:

Solution 1:

Write it into an array or object

var arr = {};
arr['new' + 'variable'] = 'Hello World';

then

alert(arr['newvariable']);

or

alert(arr.newvariable);

Post a Comment for "Double String Variable Name (javascript)"