This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user