I have an object in JavaScript that starts by looking like this:
variable = {1: 'No', 2: 'No', 3: 'No'}
and it dynamically changes based on user and updates to look like this, for example:
variabel = {1: 'Yes', 2: 'No', 3: 'Yes'}
I now want to dynamically build an if statement for any keys that have a yes to be like this:
if (feature.properties.1.indexOf(variable.1)!=-1 && feature.properties.3.indexOf(variable.3)!=-1)
Is there a way to do this? I tried looping over the object to dynamically build a string statement and then attempted to unstring it to be used in the if statement but had no luck. Any help is much appreciated.
x.1but have to usex[1]instead