I have parkingSpots
that is an array of objects which contains a property of coordinates which is also an array.
e.g index 0:
_id: "5e03c83459d0c115589067ba"
capacity: 2
description: "safas"
title: "aa"
coordinates: (2) [-34.193705512748686, 150.2320126953125]
I'm trying to find the object that has the arrayToBeFound
. I tries this solution and many others but still doesn't work.
let arrayToBeFound = [e.latLng.lat(), e.latLng.lng()];
let selectedParkingSpot = parkingSpots.find(x => x.coordinates === arrayToBeFound);
I keep getting undefined but it exists. Any help?