Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139982

typescript syntax - how to single line filter/map array [duplicate]

$
0
0

This question already has an answer here:

many times I need to loop arrays to get only specific items inside that.

here's an example:

let girls = [];
this.kidsArray.forEach(function(v){
  if(v['genre'] == 'f'){
    girls.push(v.id);
  }
});

so, is there any simpler/cleaner way to do this? maybe with filter/map array methods, or something like that?


Viewing all articles
Browse latest Browse all 139982

Trending Articles



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