This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flattenIntegerArray(array) { | |
var ret = []; | |
for (var i = 0; i < array.length; i++) { | |
if (Array.isArray(array[i])) { | |
//Add items from the sub array into the returned array | |
Array.prototype.push.apply(ret, flattenIntegerArray(array[i])); | |
} else if (Number.isInteger(array[i])) { | |
ret.push(array[i]); | |
} else { | |
// In JavaScript, you can't guarantee that the type |