One job only
A good function has one clear job. You should be able to name it with a verb phrase like formatPrice, findTopScore, or buildStudentCard.
If the name needs “and”, split the function. This makes your hackathon repo easier to read during judging or internship review.
Why functions matter
Functions turn repeated code into a reusable tool. Instead of copying the same 8 lines in three places, you write it once and call it when needed.
This also makes testing easier. You can pass sample data into a function and check the returned result before connecting it to the page or an API.