I have JS array with coordinates:
var markers = xmlDoc.documentElement.getElementsByTagName("marker");
var waypoints = new Array();
for (var i = 0; i < markers.length; i++) {
point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lon")));
waypoints.push({location: point, stopover: false});
}
I need to filter array and leave only 8 random values in it, if array length is > 8.
Thank you for the help.