Domanda di colloquio di Uber

memoize is a function that takes one argument, asynchronousFunction: function memoize(asynchronousFunction) { } where asynchronousFunction is a function that takes n arguments. The last argument of asynchronousFunction is a callback in the form of function callback(error, result).

Risposta di colloquio

Anonimo

9 dic 2024

function memoize(asynchronousFunction) { const calculatedResult = new Map(); return async function(...params) { ... } }