Overview
Implement uniqueArray(array) that returns a new array with duplicates removed, preserving first occurrence order.
Examples
uniqueArray([1,2,2,3,3,3]); // [1,2,3]
Solution
Reveal solution
function uniqueArray(array) {
return [...new Set(array)];
}unique-array.js
Unique Array
easycodingJavaScriptArrays
Overview
Implement uniqueArray(array) that returns a new array with duplicates removed, preserving first occurrence order.
Examples
uniqueArray([1,2,2,3,3,3]); // [1,2,3]
Solution
Reveal solution
function uniqueArray(array) {
return [...new Set(array)];
}NameTopicDifficulty
103 of 103 problems