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 can create an array of objects. Each object can have a year, an array of movies and the number of movies. Then on sorting the array will give the object which have highest movies 

```js
let data = {
  "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
}

let yearObj = []
// iterating the object and creating an array of objects
for (let keys in data) {
  // check in the array , if there exist an object which have smae year
  let checkIfKeyPresent = yearObj.findIndex(item => {
    return item.year === data[keys]
  })
  // if the year exist then just update movies array and the count
  if (checkIfKeyPresent !== -1) {
    yearObj[checkIfKeyPresent]['movieNo'] += 1;
    yearObj[checkIfKeyPresent]['movies'].push(keys)
  } else {
    // if it does not exist then create a new object with following keys and
    // push it to the main array
    yearObj.push({
      year: data[keys],
      movieNo: 1,
      movies: [keys]
    })
  }
}
let k = yearObj.sort((a, b) => {
  return b.movies.length - a.movies.length
})
console.log(yearObj[0])
```