FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

Difference

10mins

Implement a function difference(array, values) that returns a new array containing the elements from array that are not present in values.

Example

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

Code Editor

JavaScript Function

00:00
Loading...

Test Cases

No test results yet

Click "Run" to execute tests