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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:49:03+00:00 2026-05-28T07:49:03+00:00

Working on some code and I’m running into an issue I don’t know how

  • 0

Working on some code and I’m running into an issue I don’t know how to fix using javascript.

I have days that is a collection of objects that look like:

day: 1
a: 10
b: 5
c: 9
d: 6 

and so forth.

What I want to do is have a function that I can pass days and one of the id’s for a, b, c, d and have it do ‘something’. (By something, I’m not sure yet).

I’m just struggling to figure out how to pass the identifier.

function returnAll(data, id){
   for (var day in data){
    console.log('On day' + day + ' , ' + id + ' has a value of ' data[day].id)
   }
}

Which would ideally put something like this into the console:
On day 1 , a has a value of …
On day 2, a has a value of …

When returnAll(days, a) is called, I just can’t get the id to link up properly inside of the function. I’ll need to call this function for either a, b, c…The days can be dynamic so I need a function that operates just on the values of the id passed as the parameter.

Any thoughts?

  • 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-28T07:49:04+00:00Added an answer on May 28, 2026 at 7:49 am

    Try this to access the desired property inside your function:

    data[day][id]
    

    Call it like this:

    returnAll(days, 'a');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on some code coverage for my applications. Now, I know that
I am working on some code that deals with date ranges. I have pricing
I have been working on some code that prints a textbox that lists contact
Been working on some code streamlining and have realised that it would be really
I am working on some code that previously was using a cfquery, and is
I'm working on some image transformations using ASP.NET/C#/GDI+. I have a method that looks
I'm working on some code that uses the System.Diagnostics.Trace class and I'm wondering how
I'm working with some code that is confusing me and I'm wondering if I'm
I was working on some code recently and came across a method that had
I'm working with some code (not mine I hasten to add, I don't trust

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.