I am trying to use the string ‘pop’ as an array accessor in JS. But it is referencing the function pop()
If I try to push a value into it I will get an error.
let myKey = 'pop';
myArray[myKey].push('myValue');
// throws an error `TypeError: myArray.pop.push is not a function`
I have tried calling myKey.toString()
but it results in the same error. Is there a way to use ‘pop’ as a string accessor, without referencing the function pop().