Javascript Scenario Based Questions

 

Javascript Scenario-Based Questions with solutions:


1.  A function runs slowly when processing a large array. How would you optimize it?


(Approach: Algorithmic complexity analysis, Web Workers, or chunking with requestIdleCallback.)

2.  Users report a UI freeze when filtering a list of 10,000 items. How would you fix this?

(Solution: Virtualization, debouncing input, or offloading to a Web Worker.)

No comments:

Post a Comment

Handling multiple devices for a single user in a token-based authentication system (like JWT or OAuth2)

  1. Use Refresh Tokens with Access Tokens Access tokens should be short-lived (e.g., 15 minutes). Refresh tokens should be long-liv...

Best for you