Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. if (!arrayToCheck || !Array.isArray(arrayToCheck)) {
  2. throw new TypeError('Array expected but ' +
  3. typeof arrayToCheck + ' found.');
  4. }
  5.  
  6. if (!Array.isArray(arrayToCheck)) {
  7. throw new TypeError(`Array expected but ${typeof arrayToCheck} found.`);
  8. }
  9.  
  10. return arrayToCheck.filter((e, i, arr) => i === arr.indexOf(e));
  11.  
  12. function removeDuplicates(array) {
  13. 'use strict';
  14. if (!Array.isArray(array))
  15. throw new TypeError(`Array expected but ${typeof array} found.`);
  16. return array.filter((e, i, arr) => i === arr.indexOf(e));
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement