Example:
I'm trying to use array_diff
function from PHPJS to check if all of the elements inside selectedFeatures
are found inside elem.features
, but instead I receive undefined
. What gives?
$(markers.houses).each(function(index, elem) {
//first filter by selected features
console.log(array_diff(elem.features, selectedFeatures).length);
if (array_diff(selectedFeatures, elem.features).length == 0) {
if (!markers.houseMarkers[index].visible) {
markers.houseMarkers[index].setVisible(true);
}
}
});
Solution:
Inside array_diff()
definition change the retVal
to equal []
instead of {}
.