FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

Unique Array

10mins

Implement a function uniqueArray(arr) that removes all duplicate values from an array and returns a new array containing only unique values.

Examples

uniqueArray([1, 2, 2, 3, 4, 4, 5]); // [1, 2, 3, 4, 5] uniqueArray(['a', 'b', 'a', 'c']); // ['a', 'b', 'c'] uniqueArray([1, 1, 1, 1]); // [1]

Code Editor

JavaScript Function

00:00
Loading...

Test Cases

No test results yet

Click "Run" to execute tests