I want a column vector as my output but instead getting a single dimension array. Please check the code in the fiddle. What have I done wrong?
My Current and Expected output are:
Current Output: Array [ 0, 1 ] Array [ 5, 10 ]
Expected Output: Array [ 0 ] Array [ 1 ] Array [ 5 ] Array [ 10 ]
Please check Browser Console.
How can I get my Expected Output?
Js Fiddle: https://jsfiddle.net/4o1dj1uw/2/
Code:
this.b = [[[0,1]],[[5,10]]];
function convertarray(arrToConvert) {
//it will convert a matrix in array
var newArr = [];
for (var i = 0; i < arrToConvert.length; i++) {
newArr = newArr.concat(arrToConvert[i]);
}
return newArr;
}
console.log(...convertarray(this.b))
convertarray():console.log(convertarray(convertarray(this.b)))I'm not sure if that's what you want, but the result is one array