How would I access a variable if I have its name stored in a string?
let test1 = 6;
let test2 = 4;
function findVar(index) {
let result = "test" + index;
console.log(result);
}
findVar(1);
findVar(2);
Running this just prints 'test1' and 'test2' as strings, how can I access their values?