DEV Community

Ashutosh Sarangi
Ashutosh Sarangi

Posted on

Expert Javascript Interview Preparation

1. What are tradeoff in Event Delegation
2. What are Workers
3. Web Storage
4. HTTP methods
5. Browser Apis
6. IndexDb
7. Web Storage Capacity, not Local Storage and Session Storage.
8. Types of Observer
9. Intersection Observer
10. Service Worker and WebWorker
Ans:- https://dev.to/ashutoshsarangi/web-worker-vs-service-worker-5h50
11. Event Bubbling and Event Captureing, default argument and syntax, eventListner
12. PWA
13. background sync

14. High Performance
Browser Networking

  • http1 vs http2
  • Server Send Events
  • webRTC
  • polling → long polling vs short polling
  • WebSocket
  • sockett.io

15. debounce Vs Thruttling

const debFun = (fn, delay = 200) => {
 let timeCounter;
 return (...args) => { 
   if (timeCounter) { 
     clearTimeout(timeCounter);
   }
   timeCounter = setTimeout(() => { 
           fn(...args);
           timeCounter = null;
   }, delay); 
 };
 };

const print = () => console.log('Hello');
const testFun = debFun(print);

setInterval(() => { testFun(); }, 300);
Enter fullscreen mode Exit fullscreen mode
function throttle(fn, delay) {
  let lastCall = 0;
  return function(...args) {
    const now = new Date().getTime();
    if (now - lastCall < delay) {
      return;
    }
    lastCall = now;
    return fn(...args);
  };
}

const print = () => console.log('Hello');

const throttledPrint = throttle(print, 200);

setInterval(() => {
  throttledPrint();
}, 100);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)