VSEM-DOBRA,
<script>
"use strict"
var arr = ['A','B','C','D','E'];
function combinator(matrix){
return matrix.reduceRight(function(combination, x){
var result = [];
[...x].forEach(function(a){
[...combination].forEach(function(b){
result.push(a + b);
});
});
return result;
});
};
document.write(
JSON.stringify(combinator(Array.from({length : 4}, () => arr )))
);
</script>