[Solved] Using dot notation with variable to get object value in javascript [duplicate]


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

solved Using dot notation with variable to get object value in javascript [duplicate]