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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:11:31+00:00 2026-05-21T17:11:31+00:00

I am getting some list of values from DataBase var priceData = []; data.jobs[i].low

  • 0

I am getting some list of values from DataBase

var priceData = [];

data.jobs[i].low will give me the Value 

 for ( var i = 0; i < data.jobs.length; i++) 
{
// Need Help Here 

}

Now please tell me how can i construct the Array as

var priceData = [[0,100.34],[1,108.31],[2,109.40],[3,104.87],[4,106.00]

Means 0 index will give me 100.34 where data.jobs[0].low provides me 100.34 value , sorry fro my english .

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-05-21T17:11:32+00:00Added an answer on May 21, 2026 at 5:11 pm

    You have to create an other array, which contains the index of the iteration and the data

    [i, data.jobs[i].low]
    

    So it would be:

    for (var i = 0; i < data.jobs.length; i++)  { 
        priceData.push([i, data.jobs[i].low]);
    }
    

    Update: The below suggestions are not relevant, as the data is indeed needed as 2d data. However I will leave it in case it is of any interest.

    But this means you have to access the values with priceData[x][1]. More convenient (and natural) would be to put the values directly into the array (and not create an array of arrays):

    for (var i = 0; i < data.jobs.length; i++)  { 
        priceData.push(data.jobs[i].low);
    }
    

    which would give you can array like this:

    [100.34, 108.31, 109.40, 104.87, 106.00]
    

    which can be accessed with priceData[x].

    In most cases there is no reason to store the index, as it is given implicitly by the position of the element in the array.

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

Sidebar

Related Questions

Am getting data from database and store in dataset.dataset contains list of phone numbers.
In Django, I'm getting some values from a select field using request.POST.getlist('tags') , so
I'm getting some inexplicable behavior from easymock and a JUnit test case. I'm receiving
I have a piece of code which combines an in-memory list with some data
I have a silverlight 3 application, that fetches some simple data from a ms-sql-server
I'm facing that problem when trying to retrieving data from database: Error parsing data
I need to fetch 2 million records from the oracle database(1 year data). When
I have some values coming from a datasource that I have control over. I
I am getting a datatable with customer data from a MySql databaes and a
using a drop-down list that's populated from database fields, i need to select an

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.