2012-06-15 84 views
0

例子:PHPJS」和array_diff返回undefined

http://jsfiddle.net/7Cwbn/60/

我試圖使用array_diff功能從PHPJS,檢查所有內部selectedFeatures的元素在裏面elem.features發現,但是我收到undefined。是什麼賦予了?

$(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); 
      } 
     } 
    }); 

回答

1

解決方案:

array_diff()定義改變retVal等於[]而不是{}