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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:48:36+00:00 2026-06-08T21:48:36+00:00

how can I push data into an array in js if it’s type is

  • 0

how can I push data into an array in js if it’s type is likw this… d= [[label, value]]. At first I want to push the label data then the values….
I get the data from an xml file.
If I had only a simple array I used the simple variable.push sintax.
Will varialble[][0].push or variable[][1].push work

  • 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-06-08T21:48:37+00:00Added an answer on June 8, 2026 at 9:48 pm

    Maybe you would be better of using an object,

    So you could do

    var d  = {
    "Label" : "Value"
    };
    

    And to add the value you could

    d.label = "value";
    

    This might be a more structured approach and easier to understand if your arrays become big. And if you build the JSON valid it’s easy to make a string and parse it back in.

    Like var stringD = JSON.stringify(d); var parseD = JSON.parse(stringD);

    UPDATE – ARRAY 2D

    This is how you could declare it

    var items = [[1,2],[3,4],[5,6]];
    
    alert(items[0][0]);
    

    And the alert is reading from it,

    To add things to it you would say items[0][0] = "Label" ; items[0][1] = "Value";

    If you want to do all the labels then all the values do…

    for(var i = 0 ; i < labelssize; i ++)
    {
      items[i][0] = labelhere;
    }
    
    
    for(var i = 0 ; i < labelssize; i ++)
    {
      items[i][1] = valuehere;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to push data in javascript array into database using PHP first i
I want to be able to draw an array of balls, I can push
I have created a JSFiddle to see how much data I can push into
we have a form which inserts event data into mysql table, this then feeds
I've read file contents into a char array, and then read some data of
Is there any mechanism that I can push data into a webbrowser control from
Question: Why can't I push elements into a 2d array that's inside of a
Can the .NET RIA Service automatically push data to the silverlight client without the
I'm trying to create an array from selected table rows so I can push
How can i create a chain of viewcontrollers and push them into navigation item

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.