JS Newb here.
I’m working with a function, and the documentation for said function says “The argument to the function must be a JavaScript hash where the key is the (database) field to be filtered, and the value is either a string or an array of strings”.
Examples that work for me:
//New York Knicks fan....
viz.filter({CitiesILoathe: ['Boston']});
viz.filter({CitiesILoathe: ['Boston','Miami']});
Either of these snippets work for me, removing said cities from what I see after filter() completes.
Now I want to DIRECTLY pass in a hash which I create/populate earlier.
Can’t figure out how.
I’ve tried:
var CitiesILoathe= new Object(); //my "hash"
CitiesILoathe['Boston'] = 1;
CitiesILoathe['Miami'] = 2;
viz.filter({CitiesILoathe}); // also tried same thing w/o curly braces
…but no joy. I’ve been searching thru docs, but my JavaScript vocabulary/intelligence is slow low at this point, I really don’t know what I’m looking for.
Can anyone give me a push in the right direction? Many Thanks!
The “Hash” is the object itself.. the “keys” are the fields, in this case “CitiesILoath” and the value for those keys is an array, filled with strings.