{"size": 833, "ext": "js", "max_stars_repo_path": "Elementary/the-most-frequent.js", "max_stars_repo_name": "smallbomb/CheckIO_js", "max_stars_repo_stars_event_min_datetime": "2017-11-17T09:15:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-11T07:38:59.000Z", "max_issues_repo_path": "Elementary/the-most-frequent.js", "max_issues_repo_name": "smallbomb/CheckIO_js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Elementary/the-most-frequent.js", "max_forks_repo_name": "smallbomb/CheckIO_js", "max_forks_repo_forks_event_min_datetime": "2021-02-07T09:38:37.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-27T19:43:25.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 23.1388888889, "max_line_length": 95, "alphanum_fraction": 0.5138055222}
// https://js.checkio.org/mission/the-most-frequent/

function mostFrequent(data) {
  let words = {};
  for (const word of data) {
    words[word] = (words[word] | 0) + 1;
  }
  return Object.keys(words).reduce((a, b) => words[a] >= words[b] ? a : b);
}

console.log(mostFrequent([
  'a', 'b', 'c',
  'a', 'b',
  'a'
]));
console.log(mostFrequent(['a', 'a', 'bi', 'bi', 'bi']));


// var assert = require('assert');

// if (!global.is_checking) {
//   console.log('Example:')
//   console.log(mostFrequent([
//     'a', 'b', 'c',
//     'a', 'b',
//     'a'
//   ]))

//   assert.equal(mostFrequent([
//     'a', 'b', 'c',
//     'a', 'b',
//     'a'
//   ]), 'a')
//   assert.equal(mostFrequent(['a', 'a', 'bi', 'bi', 'bi']), 'bi')
//   console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
// }