JS contains a filter method that returns an array of search items. I would very much like to have a similar method that returns an array of indices of suitable elements. I know the findIndex method, but it only returns the first suitable index, while it would be nice to get all the necessary indices in one row.
This post is published as my personal wish.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Hi there, welcome to Dev. Please know that Dev is not a QA site. It's better to ask your questions on QA focused site like StackOverflow. Nevertheless, I'll answer your question. You don't need another builtin array method to solve your problem.
Welcome to dev.to! Out of curiosity, what is the use case for wanting the indices instead of the items themselves? Reduce might be your best bet: