Day 24: Async vibes

dhrn

Dharan Ganesan

Posted on August 11, 2023

Day 24: Async vibes

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");
Enter fullscreen mode Exit fullscreen mode

NOTE: 🤔 Attempting epic advanced-level question. Failure? Nah, fun exploration! Feel the process!😂

Check the comment below to feel more. 🤣🤣🤣

💖 💪 🙅 🚩
dhrn
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.

Related

Day 24: Async vibes
day24 Day 24: Async vibes

August 11, 2023