📌  相关文章
📜  查找每个字符串匹配 JavaScript 代码示例

📅  最后修改于: 2022-03-11 15:03:44.543000             🧑  作者: Mango

代码示例7
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);