BaseFindIndex
baseFindIndex 🔗查找数组中的索引 1 2 3 4 5 6 7 8 9 10 11 function baseFindIndex(array, predicate, fromIndex, fromRight) { const { length } = array let index = fromIndex + (fromRight ? 1 : -1) while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index } } return -1 }
阅读全文
100 字