Skip to content

Instantly share code, notes, and snippets.

@tommymarshall
Last active October 11, 2017 00:01
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 tommymarshall/48efc96d211fcfc37e031bc6885bc31e to your computer and use it in GitHub Desktop.
Save tommymarshall/48efc96d211fcfc37e031bc6885bc31e to your computer and use it in GitHub Desktop.
# of times Nationals won 2 games in a row during the regular season
// W = a win, L = a loss
const records = ['W','W','L','W','L','L','W','W','L','W','L','W','W','W','W','W','W','W','L','W','W','W','L','L','W','L','W','W','W','W','L','L','L','W','W','L','W','W','L','L','L','L','W','W','W','L','W','W','L','W','W','W','W','L','W','W','W','L','W','L','L','L','L','W','L','W','W','W','L','L','W','L','W','W','L','L','W','W','L','L','L','W','W','W','L','W','L','W','W','W','W','W','W','L','L','W','W','L','W','W','L','L','W','W','L','L','W','L','W','W','L','W','W','W','L','W','W','L','W','W','L','W','W','L','W','L','W','L','W','W','W','W','L','L','W','L','W','W','W','W','W','L','W','L','L','W','L','L','W','W','W','L','L','W','W','W','L','L','W','W','L','L'];
let last = 'L';
let wins = 0;
records.forEach((result) =>{
if (result === 'W' && last === 'W') {
wins += 1
}
last = result;
});
console.log('# of times Nats won 2 games in a row', wins);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment