So I'm iterating an array with objects and checking for a specific id, and this works fine when It has an id, but some time that is null and when it is it throws an error can't read properties of null or something similar.
Here is my function, and I would like to check the case, if it is null then just skip and don't iterate that object so I can avoid that error:
Here is the function:
const d = vehicles.vehicles.filter((vehicle) => vehicle.owner._id === quick.temp.customer._id);