Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

advanced data manipulation javascript

var flattenedArray = [];var coloursArray = [ [“blue”, “green”], [“green”, “black”, “orange”, “blue”], [“green”, “red”] ]flattenedArray = coloursArray.reduce( (total, subArray)=>{ return total.concat(subArray)},[]);console.log(flattenedArray)["blue", "green", "green", "black", "orange", "blue", "green", "red"]
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #advanced #data #manipulation #javascript
ADD COMMENT
Topic
Name
6+9 =