My code
var arr = [\'a\',\'b\',1];
var results = arr.map(function(item){
if(typeof item ===\'string\'){return item;}
});
<
My solution would be to use filter after the map.
This should support every JS data type.
example:
const notUndefined = anyValue => typeof anyValue !== 'undefined'
const noUndefinedList = someList
.map(// mapping condition)
.filter(notUndefined); // by doing this,
//you can ensure what's returned is not undefined