Sha256: acc24b4ab6c70138af2026b2405d7a29a387fff9e9cbf382747acc640613fcde
Contents?: true
Size: 475 Bytes
Versions: 72
Compression:
Stored size: 475 Bytes
Contents
/** * Here is an example solution for the FlattenArray exercise */ component { function flatten( input ) { var accumulator = []; // Loop over items in array input .each( function( i ) { // Skip nulls if( !isNull( i ) ) { // Simple values get added if( isArray( i ) ) { accumulator.append( flatten( i ), true ); // Nested arrays recurse } else { accumulator.append( i ); } } } ); return accumulator; } }
Version data entries
72 entries across 71 versions & 1 rubygems