Open
Description
Hey!
In the solution this line is
setTimeout(function() { console.log(giveHiSometimes()); }, 4000); // -> 'hi'
whilst in the original course task file it's
setTimeout(function() { console.log(giveHiSometimes()); }, 4000); // -> undefined
Therefore the solution works for the variant from the repo and does not work for the variant in the course task file.
The code below works for the task file variant, but does not work for the solution variant 😂
function debounce(callback, interval) {
let lastCall;
return () => {
const thisCall = new Date().valueOf()
const cond = !lastCall || thisCall > (lastCall + interval)
lastCall = thisCall
if (cond) return callback()
}
}
What am I missing?
Metadata
Metadata
Assignees
Labels
No labels