Code Lab

Modo entrevista. Temporizador de 3 min, sin pistas y sin autocompletado

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'.

Ejemplos

greet('dutch')

Devuelve 'Welkom'

greet('IP_ADDRESS_INVALID')

Devuelve 'Welcome'

There is no such language in the dictionary.

Fuente

Cargando el editor…
  1. Entradagreet('dutch')
    Esperado'Welkom'
  2. Entradagreet('english')
    Esperado'Welcome'
  3. Entradagreet('IP_ADDRESS_INVALID')
    Esperado'Welcome'

Las pruebas ocultas se ejecutan al enviar