Is it possible to access to an object based on a parameter on this function?
function fnc (num) {
const obj1 = { whatever : "foo1"}
const obj2 = { whatever : "foo2"}
return console.log([`obj${num}`].whatever)
}
fnc(1) // Expected Result foo1 but got undefined
Also tried with same result
`obj${num}`.whatever
Any idea? Thank you!!