Count Occurrences Of Element In Array Javascript Appendchild