[ad_1]
This should give you an idea.
const sport="soccer"
const data = {
config: {
params: {
football: {
url: '1'
},
soccer: {
url: '2'
}
}
}
}
console.log(data.config.params[sport].url)1
[ad_2]
solved Using dot notation with variable to get object value in javascript [duplicate]