'How to add array to multi array in javascript? [duplicate]
please help me
How to add array to multi array ?
var main_array = [ [9,6,7,3] , [1,7,3,9]] ;
var input_array = [3,7,1,9] ;
result :
var new_array = [ [9,6,7,3] , [1,7,3,9] , [3,7,1,9] ] ;
Solution 1:[1]
var main_array = [ [9,6,7,3] , [1,7,3,9]] ;
var input_array = [3,7,1,9] ;
main_array.push(input_array);
console.log(main_array);
Output:
[ [ 9, 6, 7, 3 ], [ 1, 7, 3, 9 ], [ 3, 7, 1, 9 ] ]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bogota |
