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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:41:29+00:00 2026-06-18T03:41:29+00:00

I want to concatenate two arrays into one. I have found two functions can

  • 0

I want to concatenate two arrays into one. I have found two functions can do the job; one is jQuery.merge() and the other one is the JavaScript built in function concat(). They seem to do the same thing, and I found this. It says: “Merge creates a smaller footprint because it loops through the original array and adds the new items. Concat is a built-in Javascript function and should be faster, but has a larger footprint.” I am not sure if this statement is true, and are there any other differences?

  • 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-18T03:41:31+00:00Added an answer on June 18, 2026 at 3:41 am

    That quote is right and the two functions do not actually do the same thing, one merges two arrays into the one (first param), and the second builds a new array from both.

    The “footprint” that it is referring to, is the max amount of memory that will be in use at any time. Since merge, is only going to duplicate the second array, it should use less memory, since at any time, it will only need to have 2 arrays in memory.

    The built in function will need to have 3 arrays, and the new array will have to be the size of both arrays that are being concatenated.

    Assuming 1000 elements in array A and B, and the merged array as C:

    • Merge would need 1000+1000[a->c], and 1000[b] or 3000 spots.
    • Concat would need 1000+1000[c] and 1000[a] and 1000[b] or 4000 spots.

    Less memory could be faster if there was a lot of memory in use, less moves could also be faster.

    Some tests I found

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

Sidebar

Related Questions

I have two environment variables in apache config, I want to concatenate them into
I want to concatenate the values of two columns into one when retrieving all
Let's say I have two char variables, and later on I want to concatenate
How would I manually concatenate two char arrays without using the strncpy function? Can
If I have two char arrays like so: char one[200]; char two[200]; And I
I have two UIImageView 's, and I want to concatenate them both to be
Had to change this up. I have two arrays and I want to essentially
I have Ienumerable<string> collection that I want to concatenate into a single string with
I have two sets of datarows. They are each IEnumerable. I want to append/concatenate
I am trying to concatenate two arrays into new array, sort in order, and

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.