unionBy
Returns every element that exists in any of the two arrays at least once, after applying the provided function to each array element of both.
- Create a
new Set()by applying allfnto all values ofa. - Create a
new Set()fromaand all elements inbwhose value, after applyingfndoes not match a value in the previously created set. - Return the last set converted to an array.