Here is how I would explain
Throttling vs Debouncing
to a 6 year old.
Throttling:
Let’s say if we have a timer for 1 hour to get a chocolate, in that scenario
I can get a chocolate every 1 hour after I ask for it.
Here the main thing to note is, “after I ask for it”.
So if I don’t ask, I’m not getting it.
Lets say we start at 12pm,
Below are my attempts to ask with time stamp:
My counter/timer/timeout is 1 hour.
12pm - I will get it (as it’s my first attempt)
12:20pm - I won’t get it as 12:20pm - 12:00pm != 1 hour
12:59pm - same as above
1:00pm- I will get another chocolate (as it meets the 1 hour criteria)
Now let’s say I ask at 2:20pm.
2:20pm - I get it as (2:20pm - 1:00pm) = more than 1 hour
3:00pm - I will not get it, as not last chocolate received time is 2:20pm and (3:00pm - 2:20pm) != 1 hour
Debouncing:
I will need to stay quiet after my last ask for a chocolate for minimum 1 hour, and then I will get the chocolate.
Starting at 12pm, and counter is 1 hour.
12pm - I asked, and I won’t get immediately, but will get at 1pm
12:30pm - I asked again, not the chocolate I was supposed to get at 1pm, I not longer will get it, and it will be at 1:30pm as 1 hour from 12:30pm is 1:30pm.
1:30pm - I will AUTOMATICALLY get the chocolate and I don’t need to ask for the chocolate
This is how you would explain Throttling vs Debouncing to a 6 year old.
Next videos we will go into a little details.
Share this video with your friends.
.
.
.
#javascript #html #programming #css #coding #java #python #developer #programmer #webdeveloper #webdevelopment #code #coder #php #webdesign #software #softwaredeveloper #computerscience #codinglife #reactjs #technology #frontend @reactjs1 #development #programmers #js #web #softwareengineer #programmingmemes #edurise #javascriptdeveloper