retry mechanism polyfill for JS fetch API with delay between each retryProblem Statement This question was asked to me for a Senior Frontend Engineer role for a leading Indian Tech Startup. Let’s say we’ve a function like getUsers which makes an API call and returns us a promise like following. The API call could be mad...2 min read·shivaansh.hashnode.devJan 21, 2025
Mastering function currying in JS for Senior Frontend InterviewsWhat is Currying? It’s an application of a closure. It’s a process in functional programming, in which we transform a function with multiple arguments into a sequence of nesting functions that take one argument at a time. So fn(a,b,c) will be tran...2 min read·shivaansh.hashnode.devJan 20, 2025
debounce polyfill: cancel, flush, and advanced features for Senior Frontend Engineer InterviewsProblem Statement Let’s go to lodash’s documentation for debounce and try to implement a polyfill for that. We’ll be building this in 3 steps. Write polyfill for a debounce function, which creates a debounced function that delays invoking func until...3 min read·shivaansh.hashnode.devJan 19, 2025
Debouncing in Javascript.While designing web applications, we need to optimize for certain scenarios, where we don't want to call a function repeatedly multiple times. An example of this could be, a callback function that is executed on window resize or a scroll event. An...5 min read·shivaansh.hashnode.devMar 11, 2022
How to make your Javascript Functions sleep?We may encounter some scenarios where we have to pause the execution of a function for some fixed amount of time. Many programming languages already have a built-in sleep method available.To halt a program for 2 seconds, we've got the following imple...2 min read·shivaansh.hashnode.devMar 10, 2022