Here you can find the source of flatten()
Array.prototype.flatten = function(){ var result = []; this.forEach(function(x) { result = result.concat(x);/*from ww w.ja v a 2 s .c o m*/ }); return result; };
Array.prototype.flatten = function() { var toString = Object.prototype.toString; var arrayTypeStr = '[object Array]'; var result = []; var nodes = this.slice(); var node; if (!this.length) { return result; node = nodes.pop(); do { if (toString.call(node) === arrayTypeStr) { nodes.push.apply(nodes, node); } else { result.push(node); } while (nodes.length && (node = nodes.pop()) !== undefined); result.reverse(); return result;
Array.prototype.flatten = function() { var originalArray = this, newArray = [], i = 0, j = 0, element, temp; for (i = 0; i < originalArray.length; i+=1) { element = originalArray[i]; ...
Array.prototype.flatten = function() { var originalArray = this; var newArray = []; var i = 0; var j = 0; var element; var temp; for (i = 0; i < originalArray.length; i+=1) { element = originalArray[i]; ...
Array.prototype.flatten = function() { var resultArray = []; innerFlatten(this); function innerFlatten(arr) { arr.forEach(function(el) { if(Array.isArray(el)) { innerFlatten(el); } else { resultArray.push(el); ...
var exchanges = [ [ {symbol: "JNJ", price: 2030.00, volume:48984}, {symbol: "PWC", price: 4340.00, volume:15985} ], [ {symbol: "CISC", price: 4563.00, volume:874651}, {symbol: "KROG", price: 712.00, volume:8949} ] ...
Array.prototype.flatten = function () { return this.reduce((p,c) => p.concat(c), [])
Array.prototype.flatten = function () { function flattenArrayOfArrays(array, result) { if (!result) { result = []; for (var i = 0; i < array.length; i++) { if (Array.isArray(array[i])) { flattenArrayOfArrays(array[i], result); } else { ...
Array.prototype.flatten = function() { return this.reduce(function(res, el) { if(el.constructor == Array) { el.forEach(function(sub_el) { res.push(sub_el); }) } else { res.push(el); return res; }, []);
Array.prototype.flatten = function () { var toReturn = []; for (var i = 0, len = this.length; i < len; i++) { if (this[i] instanceof Array) { toReturn = toReturn.concat(this[i].flatten()); } else { toReturn.push(this[i]); return toReturn; };