Design comparison
Solution retrospective
I'm proud that I used JS
What challenges did you encounter, and how did you overcome them?I have a little difficulty using functions. I don't know when to create one or not.
What specific areas of your project would you like help with?I'd like some help with functions. I know how to use them, I just don't know when to create one.
I'm open to any suggestions for my project.
Community feedback
- @kodan96Posted 6 months ago
hi there! ๐
-
There's a term in programming called modular programming. Basically, this means you should break down your programs into individual modules. And these modules very base are functions.
-
Modular programming have a lot of advantages: simplicity, reusability and scalability. With this in mind, the answer to your question: you should define functions everywhere possible.
-
Don't forget: you can use functions in
eventListeners
and conditional statements as well, making a function callback on global scope is not the only way to execute a function. ๐ โโ๏ธ
Hope this helped ๐
Good luck and happy coding! ๐ช
Marked as helpful1 -
- @AliRezaCodingPosted 6 months ago
Hello friend, functions are valuable for encapsulating code related to specific tasks, keeping it separate from the global scope and allowing for reuse throughout the program. Additionally, functions are useful when you need to process input data and produce an output, I hope this will help you, and answered: when to create functions
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord