Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

flatten array

function flatten(arr) {
  return arr.reduce(function (flat, toFlatten) {
    return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
  }, []);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flatten #array
ADD COMMENT
Topic
Name
1+9 =