indexof javascript duplicate arrays
Array.prototype.getDuplicates = function () {
var duplicates = {};
for (var i = 0; i < this.length; i++) {
if(duplicates.hasOwnProperty(this[i])) {
duplicates[this[i]].push(i);
} else if (this.lastIndexOf(this[i]) !== i) {
duplicates[this[i]] = [i];
}
}
return duplicates;
};
Also in JavaScript:
- get the current url javascript
- sum all the values in an array javascript
- javascript get body height
- javascript for schleife
- npm ERR! network If you are behind a proxy, please make sure that the ;proxy' config is set properly.
- FizzBuzz
- reverse array in javascript
- p5.js add item to array
- webslesson search bar ajax
- bootstrap dropdown not working in angular 8
- commands discord.js
- how to make fizzbuzz in javascript
- update to node 12 mac
- tolocalestring javascript currency fixing 2 decimal places
- json_extract in non native query
- sars
- anagram program in javascript
- javascript format date yyyy-mm-dd hh:mm:ss to dd-mm-yyyy hh:mm am/pm
- es6 node
- jquery get mouse page left and top
- access index of array javascript
- jwt authentication node js
- js round up decimal
- javascript localStorage clear items