Javascript: How to access the current index value inside an array stored function
Unless you know in advance which specific properties will be used, you'll need a Proxy.
const prox = new Proxy(
{},
{
get(_, prop) {
return () => prop;
}
}
);
console.log(prox[123]());
console.log(prox.hello());
console.log(prox['world']());
Since you have some non-numeric properties, you shouldn't use an array.