My code
var arr = [\'a\',\'b\',1]; var results = arr.map(function(item){ if(typeof item ===\'string\'){return item;} }); <
Since ES6 filter supports pointy arrow notation (like LINQ):
filter
So it can be boiled down to following one-liner.
['a','b',1].filter(item => typeof item ==='string');