<ul id="userList"></ul>
var list = document.getElementById("userList");

var names = ["Joe", "Kim", "Dave", "Ron", "Bill"];

names.forEach(function(name) {
	var listItem = document.createElement("li");
  listItem.innerText = name;
  listItem.onclick = function() {
  	alert(name);
  }
  list.appendChild(listItem)
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.