Here is an array that I am working with:
{
"data": [
{
"lat": 31.135859,
"lng": 46.823952,
"hd": 319
},
{
"lat": 31.050476,
"lng": 46.907204,
"hd": 320
},
{
"lat": 30.999023,
"lng": 46.957184,
"hd": 320
},
{
"lat": 30.955353,
"lng": 46.999352,
"hd": 320
}
]
}
I attempted to extract the last item from the array using the pop()
method, however, I encountered this error message:
this.heading.pop is not a function
heading: [] = [];
for (let datas of getdata['data']) {
this.heading = datas.hd;
console.log("heading"+this.heading.pop());
}
this.heading.pop();