JSFiddle - React, Tailwind, and code Playground
HTML
<div style="display: inline-block; color: rgb(0, 255, 144)">Roster:</div>
<span id="teamRoster"></span>
<br />
JavaScript
var teamRoster = ["John", "George", "Mary"];
var idList = ["john.com", "george.com", "mary.com"];
var rosterListings = "";
for (var i = 0; i < teamRoster.length; i++) {
if (i !== teamRoster.length - 1) {
rosterListings = rosterListings + " <a href='" + idList[i] + "'>" + teamRoster[i] + "</a>,";
} else {
rosterListings = rosterListings + " and <a href='" + idList[i] + "'>" + teamRoster[i] + "</a>.";
}
}
$("#teamRoster").html(rosterListings);