var a = ["1", "2"];
var b = ["a", "b"];
var c = [];
//Can someone suggest how do i push a and b into c such that c is a 2-dimensional array? (By using JavaScript)
//c should look like [["1","2"],["a","b"]]
var a = ["1", "2"];
var b = ["a", "b"];
var c = [];
//Can someone suggest how do i push a and b into c such that c is a 2-dimensional array? (By using JavaScript)
//c should look like [["1","2"],["a","b"]]
You are asking a very basic question, the answer is:
var a = ["1", "2"];
var b = ["a", "b"];
var c = []; // you could have written c = [a, b];
c.push(a, b);
It's quite simple. Just use push function and pass the array as an argument.
c.push(a);
c.push(b);
or push them together like: c.push(a,b);