Skip to content

Instantly share code, notes, and snippets.

@jbavari
Created October 15, 2014 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbavari/99225269fb740f163a96 to your computer and use it in GitHub Desktop.
Save jbavari/99225269fb740f163a96 to your computer and use it in GitHub Desktop.
//Copy and paste this in the developer console on http://www.usatoday.com/sports/nfl/arrests/
var teams = {};
//Index is index in array for each, item is the html element
var getTeamCounts = function getTeamCounts(index, item) {
console.log('index: ', index, ' item: ', item);
var teamAtr = $(item).html();
console.log('teamAtr: ', teamAtr);
var teamCount = teams[teamAtr];
console.log('team count: ', teamCount);
if(typeof teamCount == 'undefined') {
teams[teamAtr] = 0;
console.log('initing team count ' , teamAtr);
} else {
teamCount = teamCount + 1;
console.log('added 1 to team count for ', teamAtr);
teams[teamAtr] = teamCount;
}
}
$('tbody tr:gt(43)').remove()
$('tbody tr td:nth-child(2)').each(getTeamCounts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment