| Viewed 50 times

How to Find Unique Positive Numbers from Array in JavaScript?


I need a function that takes an array and returns a new array with unique positive (more than 0) numbers.

1 Answer
Mohammad Qandeel
Answered
11
function uniqueArr(arr) {
 return [...new Set(arr.filter(el => el > 0))]
}


Related Questions