×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Kale Waite
Added: Mar 30, 2017 1:55 PM
Views: 12
Takes out repeated elements in an array
  1. var origArr = [1,5,2,6,7,1,29,19,20, 1]
  2.  
  3. var newArr = origArr.filter((elem, index, arr) => arr.indexOf(elem) === index)
  4.  
  5. console.log(newArr)