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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:52:03+00:00 2026-05-16T17:52:03+00:00

I have an array, as below: var cString = [ [‘1′,’Techdirt’,’www.techdirt.com’], [‘2′,’Slashdot’,’slashdot.org’], [‘3′,’Wired’,’wired.com’] ];

  • 0

I have an array, as below:

var cString =   [
            ['1','Techdirt','www.techdirt.com'],
            ['2','Slashdot','slashdot.org'],
            ['3','Wired','wired.com']
            ];

to this array I want to add another in the same format:

var test = ['4','Stackoverflow','stackoverflow.com']

I’ve tried using:

var newArray = $.merge(cString, test);

But console.log(newArray); outputs:

[►Array,►Array,►Array,'4','Stackoverflow','stackoverflow.com']

So I’m assuming that I’m missing something obvious. Or attempting something stupid…help?

  • 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-16T17:52:04+00:00Added an answer on May 16, 2026 at 5:52 pm

    jQuery is not needed for this. Just use the Array’s .push() method to add it to the main array.

    var test = ['4','Stackoverflow','stackoverflow.com']
    
    cString.push( test );
    

    What $.merge() does is it walks through the second array you pass it and copies its items one by one into the first.


    EDIT:

    If you didn’t want to modify the original array, you could make a copy of it first, and .push() the new Array into the copy.

    var cString =   [
                ['1','Techdirt','www.techdirt.com'],
                ['2','Slashdot','slashdot.org'],
                ['3','Wired','wired.com']
                ];
    
    var test = ['4','Stackoverflow','stackoverflow.com']
    
    var newArray = cString.slice();
    
    newArray.push( test );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array below and need to know the var to get the
I have a JSON array like below: var jsonArray = [{k1:v1},{k2:v2},{k3:v3},{k4:v4},{k5:v5}] I don't know
I will have a string like below var str = -#A This text belongs
I have the loop below: var myArray = []; $(this).children('a').each(function () { myArray.push($(this).attr('href')); });
I have an array like this (below is the var_dump) array 0 => object(stdClass)[11]
I have an array (below) var img_name = new Array(images/test.jpg, images/test.jpg); var imgTotal =
I have an array below, var array = { Id:[1,2,3], Name:[one,two,five], row:[8,9,7] } but
I have HABTM and hasMany in one model like below: var $hasMany = array(
I have a string like this as below var str = '101,1245###company1-|102,1221###company2-|102,1651###company3-|-'; Can we
I have an array of objects, see below: var orderbyColumns = [Object { Descending=true,

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.