Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda