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 775579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:18:46+00:00 2026-05-14T19:18:46+00:00

how can I loop through these items? var userCache = {}; userCache[‘john’] = {ID:

  • 0

how can I loop through these items?

var userCache = {};
userCache['john']     = {ID: 234, name: 'john', ... };
userCache['mary']     = {ID: 567, name: 'mary', ... };
userCache['douglas']  = {ID: 42,  name: 'douglas', ... };

the length property doesn’t work?

userCache.length
  • 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-05-14T19:18:46+00:00Added an answer on May 14, 2026 at 7:18 pm

    You can loop over the properties (john, mary and douglas) of your userCache object as follows:

    for (var prop in userCache) {
        if (userCache.hasOwnProperty(prop)) {
            // You will get each key of the object in "prop".
            // Therefore to access your items you should be using:
            //     userCache[prop].name;
            //     userCache[prop].ID;
            //     ...
        }
    }
    

    It is important to use the hasOwnProperty() method, to determine whether the object has the specified property as a direct property, and not inherited from the object’s prototype chain.

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

Sidebar

Ask A Question

Stats

  • Questions 536k
  • Answers 536k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You are talking to the dataitem instead of the control… May 17, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer So you have to remove your application from iPhone/iPhone simulator… May 17, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like builds 5.2.28xxx are for 6.5.3 and 5.2.21xxx… May 17, 2026 at 1:19 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In rails you can use .each do || to loop through the returned results
I'm trying to move items in my list but when I compare against the
I have a flashlite3 application with navigation consisting of icons the user can browse
I am trying to make a calculator where a user can select from a
I have the JSON string below : { name:Ruby on Rails Baseball Jersey, price:19.99,
I've been developing a dynamically generated form that passes multiple items similar to the
I have a ListView in a Windows Form that I bind a list of
I would like to view/hide divs on a page, based on attribute filters. I've
I want to have a collection of objects, which will be of a class
I have a databound listbox which is actually displaying two columns of data. It

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.