Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
How insert an array inside another array

Is it possible to insert an array inside another keeping its original array form? I looked on google and didn't find what I wanted, so I'll try here. Should look like this:

arr1 = [1, 2 , 3]
arr2 = [4, 5, 6]

console.log(arr3) // [[1, 2, 3], [4, 5, 6]]
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Create a new array that references your other arrays...

const arr3 = [arr1, arr2];
console.log(arr3);
// [[1, 2, 3], [4, 5, 6]]
about 4 years ago · Juan Pablo Isaza Report

0

Or this one use array.push()

let arr1 = [1, 2 , 3]
let arr2 = [4, 5, 6]
let arr3= []
arr3.push(arr1,arr2)
console.log(arr3)

about 4 years ago · Juan Pablo Isaza Report

0

Yes its possible like the below way

var arr1 = new Array (1, 2, 3);
var arr2 = new Array (4, 5, 6);
var arr3 = new Array();
arr3[0] = arr1;
arr3[1] = arr2;
console.log(JSON.stringify(arr3))

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!