I need to pack today for our trip on Saturday since I won’t have time tomorrow. Tommy and I will be leaving tomorrow evening so we can make it for the honors breakfast, and it makes more sense to be in town rather than leaving early on Saturday. Tomorrow, Karissa and I will be heading into the city with Kel for most of the day. Karissa has a hearing aid appointment at Costco at 3:30, so by the time we return home, it will be time for Tommy and me to leave. Therefore, I must complete the packing today. It shouldn’t be too difficult, as it’s only for one night and just one suitcase for both of us. I wonder if we’ll stop at Starbucks for some coffee before we head out.
I had a sandwich and matcha tea for lunch, and I’ve been coding all day. I really need to get started on packing soon. I asked Karissa to do my laundry, so once it’s done in the dryer, I can put the clothes away and then begin packing.
Tommy fixed my desk, so it no longer leans as much. I’m making a conscious effort to ensure it remains stable by avoiding placing any weight on it. I’d prefer not to have Sandy on this desk right now. So far, it seems to be holding up well.
For coding, I think I have the debouncing function down:
function debounce(func, delay) { let timeoutId; return function (...args) { clearTimeout(timeoutId); timeoutId = setTimeout(() => { func.apply(this, args); }, delay); }; }
Breaking it down:
1. 1. function debounce(func, delay)
- func is the function you want to debounce (i.e., delay).
- delay is how long to wait (in milliseconds) after the last call before actually running func.
2. 2. let timeoutId;
- This stores the ID of the current timer.
- If a new event comes in before the delay is up, we’ll cancel this timer and start a new one.
3. 3. return function (…args)
This returns a new function that:
- Accepts any number of arguments (…args)
- Will be what you actually use as your event listener or callback
4. 4. clearTimeout(timeoutId);
- If this debounced function gets called again before the delay ends, it clears the existing timer so that func won’t run yet.
5. 5. timeoutId = setTimeout(() => { func.apply(this, args); }, delay);
- This sets a new timer.
- When the delay finishes with no further calls, it runs func.
func.apply(this, args):
- Calls func with the same ‘this context’ and original arguments.
- This is important when using the debounced function inside a method or event listener, where this matters.





