I\'ve seen several similar questions about how to generate all possible combinations of elements in an array. But I\'m having a very hard time figuring out how to write an a
Using map and flatMap the following can be done (flatMap is only supported on chrome and firefox)
map
flatMap
var array = ["apple", "banana", "lemon", "mango"] array.flatMap(x => array.map(y => x !== y ? x + ' ' + y : null)).filter(x => x)