Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

104
Visualizações
How would i make a function that will take user input and match it to a array and output the one that matches
function getItemFromSafe(password) {
    const itemsMap = {
      '10-A-w-4-878': 'Magic Wand',
      '16-R-a-9-1497': 'The one ring to rule them all',
      '5-N-3-441': 'Corgi',
      '9-Y-d-2-643': 'Apples and Pears',
      '7-H-673': 'Oscar nomination',
      '12-D-l-4-860': 'Chocolate Brownie'
    }
    return new Promise((resolve, reject) => {
      if (itemsMap[password]) {
        resolve(itemsMap[password])
      } else {
        reject('Unauthorised access to safe')    
      }
    })
  }

Then a function i want to write is

async function unlockSafe(customerName) {
  /** 
   * WRITE YOUR CODE IN HERE 
   **/
};

so i want to write a function that will generate the correct password based on the customers name who is trying to access the safe.

Like if you entered Magic Wand the password for that will come out and if there are any errors to display and error

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda