I have a config object like this
{ config: {
params: {
football: {
url: ''
},
soccer: {
url: ''
}
}
}
I simply need to get at the football
or soccer
url value using a variable, so something like
let sport = 'soccer';
let path = config.params.`sport`.url;
I've tried bracket notation like config.params[sport]
and the eval
function but neither seem to do the trick. I'm sure I'm misnaming what I'm trying to do which is likely why I can't seem to find an answer.
thanks