Answers for "js get set of fields from array without duplicates"

0

how to get unique values from array in javascript without duplicate value

function uniqueArray2(arr) {
    var a = [];
    for (var i=0, l=arr.length; i<l; i++)
        if (a.indexOf(arr[i]) === -1 && arr[i] !== '')
            a.push(arr[i]);
    return a;
}
Posted by: Guest on June-19-2020
1

javascript create array with repeated values

Array(5).fill(2)
//=> [2, 2, 2, 2, 2]
Posted by: Guest on February-17-2021

Code answers related to "js get set of fields from array without duplicates"

Code answers related to "Javascript"

Browse Popular Code Answers by Language