Created
July 5, 2018 06:28
-
-
Save jyotiarora2610/9f9bdd9d8c3adfee6eeedf5a40b442db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 7, 8, 7, 1, 2, 3] | |
var finalArr = [] | |
arr.forEach(function (element, index) { | |
if(arr.indexOf(element, index + 1) > -1) { | |
finalArr.push(element) | |
} | |
}) | |
console.log(finalArr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment