Leetcode First Repeating Element In Array Javascript Append Html