JSFiddle - React, Tailwind, and code Playground
by Ryan Mitchell
HTML
<ul class="linkList"></ul>
JavaScript
var Link = function(href, name) {
this.href = href;
this.name = name;
this.generateAnchor = function() {
return $("<a href='" + this.href + "'>" + this.name + "</a>");
};
};
var links = [new Link("http://www.google.com", "Google"),
new Link("http://www.yahoo.com", "Yahoo")];
for (var i = 0; i<links.length; i++) {
var listElement = $("<li></li>").append(links[i].generateAnchor());
$("ul.linkList").append(listElement);
}