-1

Is it possible to list out every single variation possible with some kind of filtering or mapping method? I'm using a small array/sample size, but assume the sizes vary. Focusing on 3 arrays and listing out each variation.

Thank you,


// pseudo-code!

var breakfast = ["eggs", "cereal" , "muffin"];
var lunch = ["soup", "burrito"];
var dinner =["salad", "steak", "ice cream"];



// outputs

eggs,soup,salad
eggs,soup,steak
eggs,soup,ice cream
eggs,burrito,salad
eggs,burrito,steak
...etc....
Vinny
  • 133
  • 1
  • 3
  • 10
  • 2
    Your best bet here is to do your research, [search](/help/searching) for related topics on SO, and give it a go. ***If*** you get stuck and can't get unstuck after doing more research and searching, post a [mcve] of your attempt and say specifically where you're stuck. People will be glad to help. *(Not my downvote)* – T.J. Crowder Oct 14 '20 at 17:23

1 Answers1

0

I did this a while back in php, while not javascript, perhaps you can adjust for what you need ...

https://gist.github.com/farinspace/1126042

farinspace
  • 8,422
  • 6
  • 33
  • 46
  • It was in PHP, but it does work, I was able to list out all possible variations...100k to be exact! Thank you for the script! – Vinny Oct 14 '20 at 18:08