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

  • SEARCH
  • Home
  • 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 1042551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:31:36+00:00 2026-05-16T15:31:36+00:00

I have this object: var count = { table: 15, people: 34, places_details: 85,

  • 0

I have this object:

var count = {
table: 15,
people: 34,
places_details: 85,
story_1: 21,
story_2: 6,
story_3: 11,
}

This array:

 var categories = ['table', 'people', 'places_details', 'story_1', 'story_2', 'story_3']

And this function:

function preloadThumbs()
{
var j=0;
for (j=0; j<categories.length; j++)
    {
    var k=1;
    for (k=1; k<=count[categories[j]]; k++)
        {
        $('#preload').append('<img src="graphics/thumbs/'+categories[j]+'/'+k+'.jpg" />');
        }
    }
}

…which goes through each folder by the name of categories[j] and loads all the images into a hidden <div>.
What’s a way to write the data as a single object and change the corresponding function to interpret it correctly?

  • 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-16T15:31:37+00:00Added an answer on May 16, 2026 at 3:31 pm
    var count = {
      table: 15,
      people: 34,
      places_details: 85,
      story_1: 21,
      story_2: 6,
      story_3: 11,
    }
    
    function preloadThumbs() {
      var preload = $("#preload");
      for (var kind in count) {
        for (var i = 1; i <= count[kind]; i++) {
          preload.append('<img src="graphics/thumbs/' + kind + '/' + i + '.jpg" />');
        }
      }
    }
    

    This is a way of storing all your data in one object. I do not know what you want a 2D-array for.

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

Sidebar

Related Questions

I have a Javascript object like this: var count = { table:19, people:39, places_details:84,
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers
I have an object: var seriesOptions = { y: parseFloat($(this).find('y').text()).toFixed(2), color: colors[index], level :
I have the following object: var r = { obj: $(this), children: $(this).children(), panes:
I have a javascript that does this (http is your XMLHttpRequest object) var r
I have a LINQ query that returns some object like this... var query =
I have a map array with objects stuffed with variables looking like this: var
I have this object: class a { public string Application; public DateTime From, To;
I have this object which is an instance of a superclass. I want to
I have this object below: I thought about putting the messages in html like

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.