I have a json from API
let a = [{"name": 'abc',"age": '23'},{"name": 'qwe',"age": '37'},{"name": 'wqewqe',"age": '27'}]
then I want to create a function to be called
public testing(data, variable){
console.log('Second name : ', data[1].variable)
}
if i called
this.testing(a,'name');
the result should be
Second name : qwe
can anyone share to me how to do it?
Thank you