I want to use the value of a variable to access an object of array.
I want to fill a variable with this name and use the variable to access the object.
var data = [
{lat_P: 37.4419, lon_P: -122.1419, title: 'location 1'},
{lat_T: 37.4419, lon_T: -122.1419, title: 'location 2'},
]
Example:
let type = "T";
let geometry = "lat_" + type;
console.log(data[x].[geometry]);