setTimeout(), setInterval(), and requestAnimationFrame()
When should you use requestAnimationFrame over setTimeout for animations?
Use requestAnimationFrame for animations when: 1) Visual updates need to sync with screen refresh, 2) Power efficiency is important, 3) Smooth animation is required, 4) Browser optimization is desired, 5) Dealing with visual updates or DOM changes, 6) Performance and battery life are concerns.