how to get unique values from array in javascript without duplicate value
function uniqueArray2(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;
}
Also in JavaScript:
- javascript example code
- core.js:6228 ERROR TypeError: Cannot read property 'image' of undefined
- How to create a function in javascript
- javascript skip default parameter
- pause console debugger in react
- javascript convert to array
- javascript date convert to unix
- killall node windows
- js date get hours
- promise catch
- detect browser javascript
- jstl tag
- electron quit app from renderer
- jquery reload page
- Difference in push and navigate in react Navigation
- generate random number jquery
- afficher une variable dans la console javascript
- node lodash documentation
- trigger hover event javascript
- open link in new tab jquery
- javascript indexof with condition
- jquery ready
- filter items javascript
- reactjs Module not found: Can't resolve 'styled-components