Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:20:33+00:00 2026-06-01T17:20:33+00:00

JS Newb here. I’m working with a function, and the documentation for said function

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:20:34+00:00Added an answer on June 1, 2026 at 5:20 pm
    //inline declaration
    var CitiesILoath = {
        "CitiesILoath": [
            "Boston"
            ,"Miami"
        ]
    }
    viz.filter(CitiesILoath)
    
    //ad-hoc
    var myFilter = {}; //same as "new Object()"
    myFilter["CitiesILoath"] = []; //same as "new Array()"
    myFilter["CitiesILoath"].push("Boston"); //append to array
    myFilter["CitiesILoath"].push("Miami"); //append to array
    
    //or, use decimal notation
    var myFilter = {}; //same as "new Object()"
    myFilter.CitiesILoath = []; //same as "new Array()"
    myFilter.CitiesILoath.push("Bostom"); //append to array
    myFilter.CitiesILoath.push("Miami"); //append to array
    viz.filter(myFilter)

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.NET MVC3 newb here. I am working on a MVC3 intranet application that uses
Ruby and StackOverflow newb here working my way through Ruby and ran into my
Python newb here. I m trying to count the number of letter as in
complete newb quesiton here, but I'm new to C# and Visual Studio 2010. How
Newb RoR developer here, standing at the finish line of my first paying Rails
This must be a relatively newb question but I am still stuck. I know
Jquery/programming newb here. I'm trying to dynamically assign a height to a ul to
iPhone/iPad dev newb here... I am using MonoTouch to create a universal iPad/iPhone storyboard
Newb programmer here, I'm most familiar with Python but also learning C and Java,
First post here so sorry if I seem like a newb, I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.