Question: For some reason I'm drawing a blank right now. I want to make a list that represents all the possible outcomes for the last week of football (16 total games).

There should be 2^16 (65536) outcomes excluding tie scenarios. I know I could just make 16 nested for loops with a range length of 2 in each loop, but there has to be a better way.

I want each game to essentially be a list (0 for loss, 1 for win).

Example of an outcome in a list of length 65536:

Index 0 (16 total games):

> 
> [[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1]]
> 
> 
> 

The next index might look the same (for example), except the last one is flipped

> 
> [[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[1,0]]
> 
> 
> 

Each index is a unique outcome of the week.

Any ideas? 

Thanks

Answer: 
```
var albums = {
    "Please Please Me": 1963,
    "With the Beatles": 1963,
    "A Hard Day's Night ": 1964,
    "Beatles for Sale ": 1964,
    "Twist and Shout ": 1964,
    "Help ": 1963,
    "Rubber Soul ": 1965,
    "Revolver": 1966,
    "Sgt. Pepper's Lonely Hearts Club Band": 1967,
    "Magical Mystery Tour ": 1967,
    "The Beatles ": 1968,
    "Yellow Submarine ": 1969,
    "Abbey Road": 1969,
    "Let It Be ": 1970
}

function getYear(albums) {
    var albumOccurrence = {};
    var max = 0;
    var res = [];
    for (var key in albums) {
        albumOccurrence[albums[key]] = albumOccurrence[albums[key]] ? albumOccurrence[albums[key]] + 1 : 1;
        if (albumOccurrence[albums[key]] > max)
            max = albumOccurrence[albums[key]];
    }
    console.log(max, albumOccurence);
    for (var occurrence in albumOccurrence) {
        if (albumOccurrence[occurrence] == max) {
            res.push(occurrence);
        }
    }
    if (res.length == 1) {
        res = res[0];
    }
    return res;
}
console.log(getYear(albums));

```

is this what you are looking for?
You could create a new data structure from your starting one, having the year as key, and then as value the array of the albums.

Then you can loop over your new data stracture, and get the max number of albums and the key (year) corresponding to that max: 

```js
var x = {
 "Please Please Me": 1963,
 "With the Beatles": 1963,
 "A Hard Day's Night ": 1964, 
 "Beatles for Sale ": 1964, 
 "Twist and Shout ": 1964, 
 "Help ": 1965, 
 "Rubber Soul ": 1965,
 "Revolver": 1966,
 "Sgt. Pepper's Lonely Hearts Club Band": 1967,
 "Magical Mystery Tour ": 1967, 
 "The Beatles ": 1968, 
 "Yellow Submarine ": 1969 ,
 "Abbey Road": 1969, 
 "Let It Be ": 1970
};
const res = {};
for (let key in x) {
  if (!res[x[key]]){
    res[x[key]] = [];
  }
  res[x[key]].push(key);
}

let max = 0;
let maxKeys = [];
for (let key in res) {
  if (max < res[key].length) {
    max = res[key].length;
    maxKeys = [key];
  }
  else if (max === res[key].length) {
    maxKeys.push(key);
  }
}
maxKeys.forEach(key => {
  console.log('Max year:', key, '\n', 'Albums number', res[key].length, '\n', 'Albums', res[key]);
});
```