I've this kind of arrays that generated from other function:
Code:
[[0], [0,0,0,0]]
[[1], [1,1,1,1]]
[[2], [2,2,2,2]]
[[3], [3,3,3,3]]
I want to rearrange it to:
Code:
[[0,0,0,0], [1,1,1,1], [2,2,2,2], [3,3,3,3]]
or better yet:
Code:
[0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3]
How could I do this.
This is my experiment so far and it's still far from working:
Code:
var a = [[0], [0,0,0,0]];
var b = [[1], [1,1,1,1]];
var c = [[2], [2,2,2,2]];
var d = [[3], [3,3,3,3]];

var e = [];
var f = [];
var g = [];
var h = [];

function x(data) {
	switch(data[0].toString()) {
		case '0':
			e = data[1];
			break;
		case '1':
			f = data[1];
			break;
		case '2':
			g = data[1];
			break;
		case '3':
			h = data[1];
			break;
	}
	var i = e.concat(f, g, h);
	console.log(i); // [0, 0, 0, 0]
					// [0, 0, 0, 0, 1, 1, 1, 1]
					// [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]
					// [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]
}

x(a);
x(b);
x(c);
x(d);
I want only the last result of the var i, provided that data sent is in the above order.
Thank you,