I try to read the value of the key color_ids in the following JavaScript associative array:
const UrlArray = [
{
bd_shoe_size_ids: ["6601", "6598"]
},
{
color_ids: ["6056", "6044"]
},
{
manufacturer_ids: ["5875", "5866"]
}
]
This was done by the following code:
UrlArray.find(({color_ids}) => color_ids);
But I would like to use this code for reading the value of other array keys to. For that I want to store the name of the array key whose value I want to know in a variable. If I use the code below it will of course look for a key called nameOfArrayKey, but is it possible to search for the value of the variable: nameOfArrayKey?
UrlArray.find(({nameOfArrayKey}) => nameOfArrayKey);