2012-06-15 49 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等于[]而不是{}