'use strict';

const countriesWithCapital = [
  ['UK', 'London'],
  ['France', 'Paris'],
  ['Germany', 'Berlin'],
  ['Switzerland', 'Bern'],
  ['Austria', 'Vienna'],
  ['Russia', 'Moscow'],
];

const countryForCapital = (capital) => {
  const capitalIndex = 1;
  const countryIndex = 0;
  return countriesWithCapital.find(
    (countryWithCapital) => countryWithCapital[capitalIndex] === capital
  )[countryIndex];
};

console.log(countryForCapital('Berlin'));
