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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:51:28+00:00 2026-05-31T10:51:28+00:00

I need help understanding the easiest way to create an array which carries 4

  • 0

I need help understanding the easiest way to create an array which carries 4 pieces of information and a unique ID tied to it.

My goal is to plot 4 numbers plus an ID which is what im trying to retrieve.

Then the second part of my confusion is finding some way to check the 4 numbers and get the ID. But I’m really confused how to make such an array in JS.

Any tips?

  • 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-31T10:51:29+00:00Added an answer on May 31, 2026 at 10:51 am

    If you want an array of objects and each object has four pieces of data and an id, you would do it like this:

    var list = [
        {id: "135", data: [9,129,345, 687]},
        {id: "239", data: [596,382,0,687,33467]}
    ];
    

    You would access the data like this:

    list[0].id
    list[0].data[0]
    list[0].data[1]
    list[0].data.length
    

    If you want an object that is indexed by id and each id has four pieces of data associated with it, you’d to it like this:

    var index = {
        "135": [9,129,345, 687],
        "299": [596,382,0,687,33467]
    };
    

    You would access this data like this:

    index["135"][0]
    index["135"][1]
    index["299"][0]
    

    If you know the ids and want to look data up by id, you would use the second form. If you don’t know the ids and just want to be able to easily iterate through the data and see what the ids are and the data is, then you would use the first form.

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

Sidebar

Related Questions

I need help understanding the best way to manipulate a JavaScript data structure (if
I need help understanding this type signature which is from the Thrist package. import
i need some help understanding how i can create a new custom event. i
I need help understanding how to demonize a process in Go. package main import
Kind of need help understanding what this code actually outputs. Does it out put
I need some help understanding this bit of code pre { white-space: pre; white-space:
I need some help in understanding when and why to use Remote Service instead
I need some help in understanding what is happening here .I am getting a
I have been trying out Cassandra and need some help in understanding a few
I'm a SQL noob, and I need a little bit of help understanding the

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.