So I have a bunch of variables such as:
var HelloBob = '123';
var HelloSally = 'abc';
var HelloTim = 'pie';
I need to reference these variables by constructing their names and so having their names in another variable.
So in which this would output '123' instead of 'Hellobob'
var name = 'bob';
console.log('Hello'+bob)
I've done this previously using Window[] (I think), but I attempt using it and it doesn't work. Such as...
var HelloBob = '123';
var name = 'bob';
if(typeof window['Hello'+name] !== undefined){
console.log('Variable Exists')
}
Which should only be true if a variable with the name 'Hellobob' exists, but it is always true when I run it.
I'll need to be able to reference the variables fully, so able to do .toLowerCase()