VSEM-DOBRA,
все проще простого
var arr = ['A','B','C','D','E'], a =[], x=[];
for(var k = 0; k<arr.length; k++){
a[0] = arr[k];
for(var l = 0; l<arr.length; l++){
a[1] = arr[l];
for(var m = 0; m<arr.length; m++){
a[2] = arr[m];
for(var n = 0; n<arr.length; n++){
a[3] = arr[n];
x.push(a.join(''));
}
}
}
}
console.log(x);