X 归档 2021-05-30
@rauschma Reduce might be more efficient for this. I'm sorry for any typos, I typed this on my phone:
const findIndexes = (arr, value) => arr.reduce((indexes, v, i) => ((v === value && indexes.push(i)), indexes), [])
const findIndexes = (arr, value) => arr.reduce((indexes, v, i) => ((v === value && indexes.push(i)), indexes), [])
@rauschma 这种场景用 Reduce 可能更高效。可能有错别字,抱歉,我是在手机上打的:
const findIndexes = (arr, value) => arr.reduce((indexes, v, i) => ((v === value && indexes.push(i)), indexes), [])
const findIndexes = (arr, value) => arr.reduce((indexes, v, i) => ((v === value && indexes.push(i)), indexes), [])
