JavaScript - Elements from both stacks without duplicates

JavaScript - Elements from both stacks without duplicates