Find Duplicates In String Array Javascript Append Function