I am facing a challenge with merging two object arrays that have similar values.
var Cars = [{
lat: 42,
lng: -72
}, {
lat: 40.7127837,
lng: -74.0059413
}, {
lat: 40.735657,
lng: -74.1723667
}];
var Trucks = [{
lat: 43,
lng: -72.5
}, {
lat: 40.612837,
lng: -74.1239413
}, {
lat: 40.564657,
lng: -74.1803667
}];
I attempted to merge the arrays using the code below, but unfortunately, all I see in the console are a bunch of objects with no values.
var Vehicles = Cars.concat(Trucks);
for (var i = 0; i < Vehicles.length; i++)
{
console.log(Vehicles[i]);
}