JSFiddle - React, Tailwind, and code Playground
by Marco Fucci
JavaScript
var indexes = [],
str = "uberubiub",
lastIndex = -1;
while (true) {
lastIndex = str.indexOf("ub", lastIndex+1);
if (lastIndex != -1) {
indexes.push(lastIndex);
} else {
break;
}
}
alert(indexes);