expand the values in array without duplicate in javascript code example
Example 1: removing duplicates from array javascript
var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];
var uniqueNames = [];
$.each(names, function(i, el){
if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
Example 2: how to add to array in single without repetation
result[0] = 11
result[1] = 22
result[2] = 33
result[3] = 11, 22
result[4] = 11, 33
result[5] = 22, 11
result[6] = 22, 33
result[7] = 33, 11
result[8] = 33, 22
result[9] = 11, 22, 33
result[10] = 11, 33, 22
result[11] = 22, 11, 33
result[12] = 22, 33, 11
And so on... (It's not necessary to have that order, i just want every possible variation (without repeating the same value on the index) on another array)