Push json data into array

public products:any=;

loadPeople(){
this.remoteService.load()
.then(data => {
console.log(data);
this.people = data;
this.people.sort((x,y) => new Date(x.start_time).getTime() - new Date(y.start_time).getTime());
this.products=this.people;

});

when ı write the this.products[2] its giving error “2” "is not defined. I just make push data in to products array

1.Check length of this.products
2.Then try to access this.products[2].
It may possible that no elements in this.products and you are accessing it.