javascript index of with var
var indices = [];
var array = ['a', 'b', 'a', 'c', 'a', 'd'];
var element = 'a';
var idx = array.indexOf(element);
while (idx != -1) {
indices.push(idx);
idx = array.indexOf(element, idx + 1);
}
console.log(indices);
// [0, 2, 4]
Also in JavaScript:
- javascript detect URL hash change
- ec2 yum nodejs
- js change video src
- jest mock instance
- cypress backspace
- how to delete a cookie in js
- javascript + sync for loop
- javascript coding interview questions github
- sort javascript array
- To do validation for the textbox , radio button and dropdown using jquery
- chartjs min
- React Hooks append state
- agregar año en javascript
- javascript remove event listener
- select elements id like jquery
- join method javascript
- luxon plus
- how to create react app in vs code
- automatic compile nodejs when edit
- tip in js
- pa mmj portal
- how to run a cloned react native project
- javascript remove first space in string
- square root javascript