I have an array of names and I want to show them on my page. I created an empty ul in my html
<ul id="friendsList">
</ul>
And now I want to add the names to this ol but I doesn't work
for (var i = 0; i < names.length; i++) {
var name = names[i];
var li = document.createElement('li', name);
li.parentElement('friendsList');
}
Error: Exception was thrown by user callback. TypeError: li.parentElement is not a function