var box = 'jdjsjnsdkjnsnjknsdjkfnsjnjsdjnjdsjdsn';
var arr = [];
var pos = box.indexOf('j');
while(pos > -1){
arr.push(pos);
pos = box.indexOf('j',pos+1);
}
alert(arr);
查找里面的字符串的位置
最新推荐文章于 2024-01-19 11:22:00 发布
var box = 'jdjsjnsdkjnsnjknsdjkfnsjnjsdjnjdsjdsn';
var arr = [];
var pos = box.indexOf('j');
while(pos > -1){
arr.push(pos);
pos = box.indexOf('j',pos+1);
}
alert(arr);