Languages

JavaScript - equivalent method to Ruby array.select()

0 points
Asked by:
Imaan-Morin
1009

Does JavaScript have a similar method to Array select() from Ruby?

I want something like this:

For example: 

1 answer
0 points
Answered by:
Admin Dirask Community
4380

In JavaScript, there is filter() method that does exactly what you need.

Practical example

 

See also

  1. JavaScript - how to filter array

  2. JavaScript - filter array using multiple conditions

References

  1. Array.prototype.filter() - JavaScript | MDN
0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join