'use strict';

const evolutionStages = [
  ['Pidgey', 'Pidgeotto', 'Pidgeot'],
  ['Vulpix', 'Ninetales'],
  ['Dratini', 'Dragonair', 'Dragonite'],
];

const stagesFor = (pokemon) =>
  evolutionStages.find((stages) => stages.includes(pokemon));

const stagesAfter = (pokemon) =>
  stagesFor(pokemon).slice(stagesFor(pokemon).indexOf(pokemon) + 1);

const stagesBefore = (pokemon) =>
  stagesFor(pokemon).slice(0, stagesFor(pokemon).indexOf(pokemon));

console.log(stagesFor('Vulpix')); // => [ 'Vulpix', 'Ninetales' ]
console.log(stagesAfter('Dratini')); // => [ 'Dragonair', 'Dragonite' ]
console.log(stagesBefore('Pidgeot')); // => [ 'Pidgey', 'Pidgeotto' ]
console.log(stagesBefore('Dragonair')); // => [ 'Dratini' ]
