JavaScript · Senior · Question 40 of 75
What is MutationObserver useful for?
- ✓Correct answer: It asynchronously reports DOM changes: children, attributes, text
- 2It tracks property changes of plain JS objects
- 3It intercepts
localStoragechanges in other tabs
Explanation
For example, to react to markup inserted by a third-party widget or to implement autosave for contenteditable. Change records arrive in a batch as a microtask. For JS objects use Proxy; for localStorage, the storage event.