美文网首页
数组常用方法

数组常用方法

作者: 草莓啊Pro | 来源:发表于2018-07-19 11:12 被阅读0次
    findIndex(tempArray, value) {
                   let len = tempArray.length;
                   let index = 0;
                   let result = [];
                   while (index < len) {
                       index = tempArray.indexOf(value, index);
                       if (index === -1) {
                           break;
                       }
                       result.push(index);
                       index += 1;
                   }
                   return result;
               }
    

    相关文章

      网友评论

          本文标题:数组常用方法

          本文链接:https://www.haomeiwen.com/subject/wsozpftx.html