.each() iterates jQuery collections or plain objects—handy for stamping row handlers or building arrays from <li> nodes. Returning false breaks early (unlike native forEach).
.map()
.map() projects a new jQuery collection—useful before DOM insertion. For heavy transforms, convert to arrays and use modern helpers once migrated.
Performance
Avoid $('.row').each attaching identical handlers—delegate from tbody instead. Cache the parent selector outside scroll handlers.
Self-check
- How do you break out of .each early?
- When prefer delegation over per-row .each?
Pitfall: Returning false from .each() breaks early—use a plain for loop when you need complex control flow.