Skip to content

Instantly share code, notes, and snippets.

@tommymarshall tommymarshall/
Last active Oct 11, 2017

What would you like to do?
# 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
You can’t perform that action at this time.