Skip to content

Instantly share code, notes, and snippets.

@misutowolf
Created March 9, 2015 15:59
Show Gist options
  • Select an option

  • Save misutowolf/8a3207b821b2b6818cd6 to your computer and use it in GitHub Desktop.

Select an option

Save misutowolf/8a3207b821b2b6818cd6 to your computer and use it in GitHub Desktop.
for (var i = 1; i <= numRanks; i++) {
var rankName = theRanks[i-1].name + "s";
theHTML += "<h5>" + rankName + "</h5>";
var theGroup = _.filter(theRoster, function(item) { return item.rank === i; });
console.log(JSON.stringify(theGroup));
// Check for empty rank (no members of rank)
if (_.isEmpty(theGroup)) {
theHTML += "<ul><li>None</li></ul>";
} else {
theHTML += "<ul>";
for (obj in theGroup) {
theHTML += "<li>" + obj.user + "</li>";
}
theHTML += "</ul>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment