user3821345 user3821345 - 2 years ago 84
Javascript Question

Selecting multiple properties in Javascript or D3

I'm trying to remove a few data points from a map created in D3.

Here I'm removing a property with name matching "Luxembourg", but I would also like to remove a property with name matching "Liechtenstein". How should I write this?

.filter(function(labels) {
return != "Luxembourg";

I have tried using javascript references but I'm having trouble applying these.

Answer Source

How about using Array.prototype.indexOf

.filter(function(labels) {             
   var toFilter = ['Luxembourg', 'Liechtenstein']
   return toFilter.indexOf( !== -1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download