0

I have a variable: var a = "testing_here", and I want to create another variable, but I want its name to be the value of a. For example, in a perfect world, it would look something like this: var testing_here = _______

How can I get this desired result?

1 Answers1

-1

You can use bracket notation:

var a = "testing_here"
window[a] = "___";
console.log(testing_here);
Spectric
  • 27,594
  • 6
  • 14
  • 39