indeiesOf
indexOf
の複数形
code:indiesOf.ts
export const indicesOf = function (sentence, value) {
const positions = []
let pos = sentence.indexOf(value)
while (pos !== -1) {
positions.push(pos)
pos = sentence.indexOf(value, pos + 1)
}
return positions
}