Learn a few advanced reduction patterns: flatten allows you to merge a set of arrays into a single array, the dreaded flatmap allows you to convert an array of objects into an array of arrays which then get flattened, and reduceRight allows you to invert the order in which your reducer is applied to your input values.
With this you could flatten virtually infinitely nested arrays :)
function flatten(data){return data.reduce(function(acc, value){return acc.concat(value.constructor === Array ? flatten(value) : value)}, [])}
how about using a filter instead of forEach inside the reducer?
Wouldn't it make more sense to use:
const cast = movies.reduce((acc, cur) => [...new Set(cur.cast)]);