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