I've been wrapping my head around this for a while, the solution needs to be written in JS.
I need to make every possible sentence based on an array of options for each word, will explain in detail below:
Hello | my | name | is | John
Is the main sentence I will base this example off, each word in the sentence has a dynamic array of other words that could take their space.
let firstWord = ["Hello", "Hi", "Howdy"];
let secondWord = ["my", "your"];
let thirdWord = ["name"];
let fourthWord = ["is", "isn't"];
let fifthWord = ["John"];
I tried to find out the number of possible sentences by multiplying each array length, then iterating through the arrays to fill it out but can not grasp the iteration method I need to do this.
How could I solve this?