I'm a newbie and trying to create a function in JavaScript that given a string and the number of draws and will return an array of all possible combinations of the letters.
Eg. the urn contains of 3 balls (A B C) and 3 draws should return
fun (ABC, 3) -> AAA, AAB, AAC, ABA, ..... CCC
As well as:
fun(A, 2) -> A A
fun(AB,2) -> AA, AB, BA, BB
And also in case of (A B C) and 2 draws the fun() should return
fun(ABC, 2) -> AA, AB, AC, BA, BB, ....
Do you have any idea ?
Thanks.