Removing duplicates from an array with vanilla JavaScript