I'm still new to learning loops so I'm a little confused. I have a for...in loop that loops a json file of objects. Then I have jQuery create some html elements for each object. I have one problem though, every time it loops, it repeats the previous objects along with the new one so the output becomes:
-name
-name
-test
-name
-test
-someone
-name
-test
-someone
-something
But I'm trying to do
-name
-test
-someone
-something
How can I achieve this?
My current code for it is this:
var html = ""
for (var name in urls) {
html += `<div class='card-panel white'><div class='container'><div class='row'><div class='input-field col s12'> ${name} <br> ${urls[name].url} </div></div></div></div>`
$("#main").append(html)
}