{"size": 765, "ext": "js", "max_stars_repo_path": "js/Arrays/MethodLastIndexOf/index.js", "max_stars_repo_name": "Adxell/practicewithjavaScript", "max_stars_repo_stars_event_min_datetime": "2021-11-24T04:16:00.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-24T04:16:00.000Z", "max_issues_repo_path": "js/Arrays/MethodLastIndexOf/index.js", "max_issues_repo_name": "Adxell/practicewithjavaScript", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/Arrays/MethodLastIndexOf/index.js", "max_forks_repo_name": "Adxell/practicewithjavaScript", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.6153846154, "max_line_length": 61, "alphanum_fraction": 0.5908496732}
const animals = [
  "Dodo",
  "Tiger",
  "penguin",
  "penguin",
  "penguin",
  "penguin",
  "Dodo",
  "Dodo",
  "Dodo",
  "Dodo",
];

console.log(animals.lastIndexOf('Dodo'));
console.log(animals.lastIndexOf('Tiger'));

//example 

var numbers = [2, 5, 9, 2];
numbers.lastIndexOf(2);     // 3
numbers.lastIndexOf(7);     // -1
numbers.lastIndexOf(2, 3);  // 3
numbers.lastIndexOf(2, 2);  // 0
numbers.lastIndexOf(2, -2); // 0
numbers.lastIndexOf(2, -1); // 3

//finding all the occurrences of an element
var indices = [];
var array = ['a', 'b', 'a', 'c', 'a', 'd'];
var element = 'a';
var idx = array.lastIndexOf(element);
while (idx != -1) {
  indices.push(idx);
  idx = (idx > 0 ? array.lastIndexOf(element, idx - 1) : -1);
}

console.log(indices);
// [4, 2, 0]
