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...Jan 21, 2025 · 2 min readshivaansh.hashnode.dev
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...Jan 20, 2025 · 2 min readshivaansh.hashnode.dev
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...Jan 19, 2025 · 3 min readshivaansh.hashnode.dev
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...Mar 11, 2022 · 5 min readshivaansh.hashnode.dev
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...Mar 10, 2022 · 2 min readshivaansh.hashnode.dev