Skip to main content

Explain lazy loading of modules and resources.

Senior JavaScript
Quick Answer Lazy loading modules: const { feature } = await import("./feature.js") loads only when needed รขโ‚ฌโ€ not at startup. Dynamic import() returns a Promise. Combined with route-based splitting in bundlers (Webpack, Vite), each page/route loads only its own code. Images: IntersectionObserver or loading="lazy" attribute. Both reduce initial load time and improve performance metrics.

Answer

Lazy loading delays non-critical modules until needed.

Reduces initial load time and improves page performance.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice