I am unable to get why I am getting error that cannot read property. I am reading data from EndPonit API and my property name of json object which is label is correct. Actually,I am pushing data into array and making an array of objects. Here is my code. Can anyone help me please?Thanks
js code
let airports=[];
fetch('http://myApi')
.then(response => response.json())
.then(airportData=>{
this.airports.push({
'code':airportData.label.substr(0,3),
'city':airportData.label.split(',')[1],
'country':airportData.label.split(',')[2],
'airportFullName':airportData.label.split(',')[3]
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…