Day 24: Async vibes
Dharan Ganesan
Posted on August 11, 2023
Today will feel the async vibes! ⏰ with custom timer implementation
Question
Implement polyfill function that simulates the setTimeout
using callbacks.
window.mySetTimeout = function(callback, delay) {
// Todo add your code
};
function delayedFunction() {
console.log("Delayed function executed");
}
console.log("Start");
mySetTimeout(delayedFunction, 1000);
// Delayed function will be called after approximately 1000ms
console.log("End");
NOTE: 🤔 Attempting epic advanced-level question. Failure? Nah, fun exploration! Feel the process!😂
Check the comment below to feel more. 🤣🤣🤣
💖 💪 🙅 🚩
Dharan Ganesan
Posted on August 11, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.