Code Lab

Modo entrevista. Cronômetro de 3 min, sem dicas e sem autocompletar

Welcome by language

FácilMap and Set3 min

Greetings in different languages are already in the Map GREETINGS. The key is the language name, the value is the greeting.

Write a function greet(language) that returns the greeting in that language. If the language is not in the dictionary, return the English 'Welcome'.

Exemplos

greet('dutch')

Retorna 'Welkom'

greet('IP_ADDRESS_INVALID')

Retorna 'Welcome'

There is no such language in the dictionary.

Fonte

Carregando o editor...
  1. Entradagreet('dutch')
    Esperado'Welkom'
  2. Entradagreet('english')
    Esperado'Welcome'
  3. Entradagreet('IP_ADDRESS_INVALID')
    Esperado'Welcome'

Os testes ocultos rodam no envio