Today's puzzle
What's missing in this code?
// Compress multiple singulars into 1 plural
pluralize(['orange', 'banana', 'orange', 'orange']);
// ['oranges', 'banana']
pluralize(['blue', 'red', 'yellow', 'red']);
// ['blue', 'reds', 'yellow']
function pluralize(arr) {
return [
].map((e) =>
arr.
(e) == arr.lastIndexOf(e) ? e : e +
);
}
Type or select from these options