Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Does rounding here reduce workload?

I picked up a code snippet online somewhere that has a function

$(window).on('scroll', function() {

   // round to reduce workload
   scrollXPos = Math.round($(window).scrollTop() / 10) * 10;

the comment says this reduces the workload. I can't see how? I thought it was actually creating more workload because it has to round the number every time? Or does this mean that the workload is reduced because the code following this line isn't executed as often?

is there a way to reduce the workload of the window scroll function?