摘要: 案例1:查找字符 ‘o’ 出现的位置及次数 function find(str) { var index = str.indexOf('o'); var num = 0; while (index !== -1) { console.log(index); // 位置 num++; index = str.indexOf('o', index + 1); } console.log(num); / 阅读全文
posted @ 2019-09-26 13:22 晴天宝宝i 阅读(155) 评论(0) 推荐(0) 编辑