Improvement in code : actually that extra if() can be avoided if we use clientX, clientY instead of offsetX, offsetY. clientX/clientY : give us coordinates relative to top-left corner of browser window (what we want) offsetX/offsetY; give us coordinates relative to top-left corner of parent Element , as here parent of text is that hero div , so it take it according to that. if no element parent is available then is taken as parent. conclusion: you can replace destructuring assignment line with this line let { clientX: x, clientY: y } = e; and delete if() statement.
These videos are pretty good. Keep them coming. I'm not someone who always comment on videos, but since there was no comment yet I thought it would be good to say something.
Destructuring assignment. that line of code is essentially: var width = hero.offsetWidth var height = hero.offsetHeight developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment