trivago interview question

Remove duplicate words from a string in JS