There is a js array in which there are simple elements, for example, ordinary letters, and there are elements that are themselves arrays. It is necessary to make all the combining elements.
Example:
1 авп к 4 5п
Need to get:
1ак45, 1вк45, 1пк45, 1ак4п, ...
In general, it is necessary to make all such combinations. The length of the common array and embedded arrays is variable, the position and number of embedded arrays also vary. Throw ideas on how to organize a brute force algorithm?