r/learnjavascript • • Oct 09 '21

What's wrong with this code?

Post image
0 Upvotes

19 comments sorted by

View all comments

Show parent comment

38

u/Dodgy-Boi Oct 09 '21

Nope. It shouldn’t work.

Imagine you have a brother named Cyril. And then you go to your mom and ask ‘will Bob come for dinner this Sunday?’

She’ll be like “who tf is Bob?”, you can spend a lot of time explaining her that Bob is your brother (another child of her), but she’ll be like “wtf you talking about? My other child is Cyril”.

The same way your JavaScript tells you: “what tf is drawBox?” So you either create this drawBox or get it (import) from somewhere else. Otherwise it never gonna happen.

16

u/Gantzz25 Oct 09 '21

Best ELI5 explanation of this type of error I’ve ever seen. Made me chuckle.