摘要: indexOf方法可以传两个参数,第二个参数是传位置的参数,利用这点获取所有的位置。例如: var str = "hello world,welcome!"; var arr = []; var pos = str.indexOf("o"); while(pos>-1){ arr.push(pos) 阅读全文
posted @ 2017-01-11 15:34 MrLuo 阅读(3301) 评论(0) 推荐(0) 编辑