It stops repeated UI items. Sets help you check if a value exists. const tags = new Set (); tags.add ("javascript"); console.log (tags.has ("javascript")); // true Use Sets for: - Filters - ...
The browser provides extra help. When you use a timer, JavaScript hands that task to the browser. The browser handles the wait. Once the timer ends, the browser tells JavaScript to run the callback.