This is an example of a debounce function
Everytime you scroll, an event is triggered. If we want to trigger some function (ie the percentaged scrolled) this function will trigger eveytime we scroll, taking up lots of resources and lowering performance.
Instead, we use a debounce, which will execute the function only after a certain amount of time has passed OR execute the function first and wait some time to before the next time to excute (as long as the scroll event is still happening).
This improves performance, as the function is not triggered lots of times