Instead of adding the index at the end of every id it would be more descriptive to add the tag type at the end.
Only if 2 or more tags have the same id (including the tag type) then an additional count will be added at the end. This will probably have to be recursive
function addCount(id, index, content){
If(obj[id]) {
index += 1
var newId = id+index
addCount(newId, index)
}
else obj[id] = content
}
Instead of adding the index at the end of every id it would be more descriptive to add the tag type at the end.
Only if 2 or more tags have the same id (including the tag type) then an additional count will be added at the end. This will probably have to be recursive