Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find every character string match JavaScript

let indices = [];
let array = "scissors".split('');
let element = 's';
    
let idx = array.indexOf(element);
    
while (idx !== -1) {
   indices.push(idx+1);
   idx = array.indexOf(element, idx + 1);
}
console.log(indices);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #character #string #match #JavaScript
ADD COMMENT
Topic
Name
1+3 =