Índice de retorno de matriz de filtro JavaScript

const polyfillter = (arr,condition) => arr.map( (e,i) => condition ? i : -1).filter(e=>e>=0)    
//pass an array, and your filter condition and watch the magic 
Brian Patterson