Created
October 29, 2019 20:04
-
-
Save romaefGit/8d3c56fc60ed8b2328519af850d38381 to your computer and use it in GitHub Desktop.
JavaScript - Arreglo único de indices normales
This file contains hidden or 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
| /** | |
| * [uniquesArraySimply Duvelve un arreglo sencillo sin items repetidos: | |
| example : arreglo ENVIADO = ['1',0,1,'2'] | |
| arreglo RETURN = [0,1,'2']] | |
| * @param {[Array]} arr [El areglo normalito.] | |
| * @return {[Array]} [El arreglo sin indices repetidos] | |
| */ | |
| var function = uniquesArraySimply(arr) { | |
| var a = []; | |
| for (var i = 0, l = arr.length; i < l; i++) | |
| if (a.indexOf(arr[i]) === -1 && arr[i] !== '') a.push(arr[i]); | |
| return a; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment