Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to nicely filter inside an array of object?

$
0
0

Also ES6 comes with includes which will replace that ugly indexOf(str) >= 0, supported in the most important browsers like Edge, FF>= 43, Chrome and Opera, and Node >= 4, it would look like:return this.items.filter((item) => {

return this.items.filter((item) => {
  if (item.id.contains(str) ||
      item.name.contains(str) ||
      item.position.contains(str)) {
    return true
  }
  return false
})

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>