-
const rand = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const makeRandomScores = () => {
let scoreArray = [];
for (let inning = 1; inning < 10; inning++) {
scoreArray.push(rand(0, 4));
}
scoreArray.push(scoreArray.reduce((a, b) => a + b, 0));
return scoreArray;
}
const teams = [
{ "name": "Milwaukee Brewers", scores: makeRandomScores() },
{ "name": "Los Angles Dodgers", scores: makeRandomScores() },
{ "name": "New York Mets", scores: makeRandomScores() },
{ "name": "St. Louis Cardinals", scores: makeRandomScores() },
{ "name": "Houston Astros", scores: makeRandomScores() },
{ "name": "Toronto Blue Jays", scores: makeRandomScores() },
{ "name": "Boston Red Sox", scores: makeRandomScores() },
{ "name": "Chicago Cubs", scores: makeRandomScores() },
{ "name": "Philadelphia Phillies", scores: makeRandomScores() },
{ "name": "Chicago White Sox", scores: makeRandomScores() },
{ "name": "San Diego Padres", scores: makeRandomScores() },
{ "name": "Cleveland Indians", scores: makeRandomScores() },
{ "name": "San Francisco Giants", scores: makeRandomScores() },
{ "name": "Cincinatti Reds", scores: makeRandomScores() },
{ "name": "Minnesota Twins", scores: makeRandomScores() },
{ "name": "Tampa Bay Rays", scores: makeRandomScores() },
{ "name": "Miami Marlins", scores: makeRandomScores() },
{ "name": "Oakland Athletics", scores: makeRandomScores() },
{ "name": "Detroit Tigers", scores: makeRandomScores() },
{ "name": "Pittsburgh Pirates", scores: makeRandomScores() },
{ "name": "Seattle Mariners", scores: makeRandomScores() },
{ "name": "Atlanta Braves", scores: makeRandomScores() }
];
div(role="region", aria-labelledby="caption", tabindex="0")
table
caption#caption Baseball numbers mmkay.
thead
tr
th Teams
each val in [1, 2, 3, 4, 5, 6, 7, 8, 9]
th= val
th Runs
tbody
each team in teams
tr
th= team.name
each score in team.scores
td= score