How can I retrieve value of Object using String as a key? The key in the object is just literal. Here's an example of the issue I am encountering.
let object = {
a: 1,
b: 2
}
let stringkey = "a"
console.log(object[stringkey]) // cannot obtain the value from Object
I cannot just modify the keys in the object or use hard corded data into obtaining the values, as the data is pulled out from the API and the string key is used from forEach loop.
Thanks for the help