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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:11:48+00:00 2026-06-11T07:11:48+00:00

I have a several arrays that I need to concat into a new one.

  • 0

I have a several arrays that I need to concat into a new one. I’m doing this:

function ConcatArrays() {

     var TheNewArray = [];

     function TheConcat(TheArray) { TheNewArray = TheNewArray.concat(TheArray); }

     for (var i = 0; i < SomeArrayOfObjects.length; i++) {

         if (SomeCondition) { TheConcat(SomeArrayOfObjects[i]); }
     }
}

For some reason, TheNewArray is always empty. Is there something I’m missing?

  • 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-11T07:11:50+00:00Added an answer on June 11, 2026 at 7:11 am

    You’re assigning a new array to the local parameter.
    This does not affect that variable that you passed as a parameter.

    You can add an array to an existing array instance (as opposed to creating a new array) like this:

    Array.prototype.push.apply(oldArray, newArray);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several arrays that are built similar to this: exampleArray=new array( A01 -
I have several situations where I need to pass multi-dimensional PHP arrays into Javascript/jQuery.
I have several arrays that need to be sorted side by side. For example,
I have a 2D array that I have split up into several 1D arrays
I am using jQuery 1.7.1 (but that's probably irrelevant). I have several JavaScript arrays
I have a several DBF files generated by a third party that I need
I have a query that searches through several tables and returns one row for
I am creating several byte arrays that need to be joined together to create
I have several (27) images represented in 2D arrays that I am viewing with
I have a Qt dialog box with several controls that need more or less

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.