[Solved] How to set specific variable name?


What you want is a scoped namespace like myVariables to be used as a dictionary, e.g.

// this prevents keys like `hasOwnProperty` from being pre-defined on namespace
var myVariables = Object.create(null);

function test(name) {
  myVariables['a' + name] = 'test text';
}

test('test');
console.log(myVariables.atest);

solved How to set specific variable name?