EDIT: This did not answer the OP's question, slightly different topic. This should be the right one.
Finding All Combinations of JavaScript array values
I would approach this problem from a more 'general' standpoint. You have an array, and would like to get a random value from it. As long as you know the length of the array, this is easy. The way I would do it is, generate a random index from the 'length' property of the individual array and pull that out.
Here is a quick and dirty demo.
var sentence = '';
var fragments = [
['delicious', 'bad', 'gross'],
['red', 'green', 'blue'],
['apple', 'orange', 'basketball']
];
// This could be used over and over for any array,
// just pass it the length
function randomIndex(i) {
return Math.floor(Math.random() * i);
}
// This is more specific to your use case, go into each
// each child array and just pick a random element
fragments.forEach(function(el) {
possibleIndex = randomIndex(el.length);
// Join the next piece
sentence += el[randomIndex(possibleIndex)] + ' ';
});
// Do something with sentence here
console.log(sentence) //=> 'bad green apple'
You can clean this up of course, and would need to clear that sentence variable each time. Like I said, quick and dirty. Stuff like this should be abstracted out, and is a common use case for libraries such as underscore and lodash.
Here is a bin that shows it in action.
https://jsbin.com/guxiziwoqa/edit?html,js,output