This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -41,13 +41,30 @@
|
||||
['Dratini', 'Dragonair', 'Dragonite'],
|
||||
];
|
||||
|
||||
const stagesFor = (pokemon) => {};
|
||||
const stagesFor = (pokemon) => {
|
||||
const stages = evolutionStages.find((stages) => stages.includes(pokemon));
|
||||
|
||||
const stagesAfter = (pokemon) => {};
|
||||
if (!stages) {
|
||||
console.warn('stages not found');
|
||||
return [];
|
||||
}
|
||||
|
||||
const stagesBefore = (pokemon) => {};
|
||||
return stages; // wenn unfedined leeres array zurückgeben
|
||||
};
|
||||
|
||||
const stagesAfter = (pokemon) => {
|
||||
const stages = stagesFor(pokemon);
|
||||
|
||||
return stages.slice(stages.indexOf(pokemon) + 1);
|
||||
};
|
||||
|
||||
const stagesBefore = (pokemon) => {
|
||||
const stages = stagesFor(pokemon);
|
||||
return stages.slice(0, stages.indexOf(pokemon));
|
||||
};
|
||||
|
||||
console.log(stagesFor('Vulpix')); // => [ 'Vulpix', 'Ninetales' ]
|
||||
console.log(stagesAfter('Anton')); // =>
|
||||
console.log(stagesAfter('Dratini')); // => [ 'Dragonair', 'Dragonite' ]
|
||||
console.log(stagesBefore('Pidgeot')); // => [ 'Pidgey', 'Pidgeotto' ]
|
||||
console.log(stagesBefore('Dragonair')); // => [ 'Dratini' ]
|
||||
|
||||
Reference in New Issue
Block a user