This commit is contained in:
Philippe Torrel
2026-09-25 10:48:02 +02:00
parent 10a2db696a
commit be3e41749c
10 changed files with 182 additions and 32 deletions
+16 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -36,7 +36,21 @@
['Russia', 'Moscow'],
];
const getCapitalOf = () => {};
const getCapitalOf = (country) => {
return countriesWithCapital.find((countryWithCapital) => countryWithCapital[0] === country)[1];
};
// const capitalOf = (country) => {
// const capitalIndex = 1;
// const countryIndex = 0;
// return countriesWithCapital.find((countryWithCapital) => countryWithCapital[countryIndex] === country)[
// capitalIndex
// ];
// };
console.log('Switzerland:', getCapitalOf('Switzerland'));
console.log('Germany:', getCapitalOf('Germany'));
console.log('Russia:', getCapitalOf('Russia'));
</script>
</body>
</html>