{"size": 801, "ext": "js", "max_stars_repo_path": "arrays/duplicates/finddupes.js", "max_stars_repo_name": "dtodo1paco/js-basics", "max_stars_repo_stars_event_min_datetime": "2021-07-02T08:52:10.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-26T16:48:08.000Z", "max_issues_repo_path": "arrays/duplicates/finddupes.js", "max_issues_repo_name": "dtodo1paco/js-basics", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "arrays/duplicates/finddupes.js", "max_forks_repo_name": "dtodo1paco/js-basics", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 33.375, "max_line_length": 88, "alphanum_fraction": 0.5692883895}

// task8 = [
//   [2,5,1,2,3,5,1,2,4], Should return 2
//   [2,1,1,2,3,5,1,2,4], Should return 1
//   [2,3,4,5], Should return undefined
//   [2,5,5,2,3,5,1,2,4] Should return 5
// ]

const firstDupeValue = (list) => {
  const dict = {};
  let found = 0;
  for(let i=0; i < list.length && !found; i++) {
    const value = list[i];
    if (dict.hasOwnProperty(value)) {
      found = i;
    }
    dict[value] = true;
  }
  return found ? list[found] : undefined;
};
console.log(`[2,5,1,2,3,5,1,2,4], Should return ${firstDupeValue([2,5,1,2,3,5,1,2,4])}`)
console.log(`[2,1,1,2,3,5,1,2,4], Should return ${firstDupeValue([2,1,1,2,3,5,1,2,4])}`)
console.log(`[2,3,4,5], Should return ${firstDupeValue([2,3,4,5])}`)
console.log(`[2,5,5,2,3,5,1,2,4], Should return ${firstDupeValue([2,5,5,2,3,5,1,2,4])}`)