Within my text box, the user inputs strings separated by commas. These strings are split on the front end, then sent to the backend to retrieve data in JSON format.
The interesting part is that when I directly entered the key of the JSON, like this, it worked:
var price = fun.results.KO;
However, when I attempted to use the value from the split list, it consistently returned an error:
list_of_key = ["KO", "OK", "NA"]
fun.results.list_of_key[1];
The error message displayed was: Uncaught TypeError: Cannot read property '0' of undefined.
Where did I go wrong? How can I rectify this issue?
If this were Python, it would be a whole different scenario.