I am new to Javascript, I have a very simple question. I want my array become [1,2,3,4,5,6,7,8,9,10] from [1,2,3,[4,5,6,7,],9,10] But I get error while I try to loop them to a new array. Any better solution?
var theArray = [1,2,3,[4,5,6,7,],9,10] //I want this array become [1,2,3,4,5,6,7,8,9,10]
//when I try to do so it have error, below is my code
//Test.isArray is a function I check is it an array
var i, j;
var IdLog =[]
for (j = 0; j < theArray.length; ++j) {
if (!Test.isArray(tempID[j])) {
IdLog.push(thArray[j]);
console.log(IdLog);
} else {
for (k = 0; theArray[j].length; ++k) {
IdLog.push(theArray[j][k]);
console.log(IdLog);
}
}
}