API to watch DOM changes: node additions/removals, attribute modifications.
Solution Code
JavaScript
const observer = new MutationObserver(callback);
observer.observe(target, config);
Explanation
More efficient than polling. Used in frameworks for change detection.Guided Hints
Disconnect observer
Performance considerations