I need to do this Ps: "a" and "b" are just variables for the example, i want to send this numbers to another variable with a button , and with this "new variable" use ${} to call the correct object from my class
class MyClass(){
constructor(parameter){
}
}
let j1 = new MyClass(parameter);
let j2 = new MyClass(parameter);
let a = 1;
let b = 2;
function hi() {
if (envt == true) {
let something = j${ a }.parameter;
} else {
let something = j${ b }.parameter;
}
alert(something);
}
Sorry I hope you understand, I am new in js, Thanks