Day 5 of 30 - Tip Calculator App (Part - 2)

Leader โ—2 โ—9 โ—27
calendar_today ago โ€ข schedule1 min read

I finally got the Tip calculator to function!

For real I'm still trying to figure if this JavaScript is for me because, why did it have to stress me so much?!๐Ÿ˜ญ

For this phase of the challenge, my goal was:

  • To get the UI looking as close as possible like the design.
  • Design active states.
  • Get the buttons and inputs to function as expected.
  • Display the calculated result.

My Process:

  • I declared all relevent DOM elements as inputs in JavaScript.
  • Wrote a calculateTip() function to calculate Total Tip / person and Total Amount/person, if both Bill and Number of Persons inputs were not zero.
  • I rendered the tip buttons as a loop and called the calculateTip() function on each button with a click event.
  • At Reset, I declared all variables back to 0 (except number of persons which I left at 1).

Challenges and AI collaboration:

I faced several challenges and bugs but after several hours of brain wracking, I worked with Gemini to figure things out. I didn't just ask the AI to generate the codes. I asked how things were done and when the AI suggested, I tried them out.

Continued development

I didn't do so much form validation in this phase of the project, except a condition to check that the inputs were not 0. For further development, I plan to learn more about form validation in JavaScript, then do a better job in validating the forms.

I'm not sure what the next project holds but I'm excited.๐Ÿ˜Š

๐Ÿ”ฅ Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Day 4 Of 30 - Tip Calculator App (Part - 1)

Liz - Oct 6

My 30-day log cleanup kept a file that was 30 and a half days old

BashSnippets - Oct 8

Day 2 of 30 - Building A Blackjack Game (Part - 2)

Liz - Oct 1

Tuesday Coding Tip 06 - Explicit template instantiation

Jakub Neruda - Apr 7

Day 3 Of 30 - Building A Blackjack Game (Part-3)

Liz - Oct 2
chevron_left
1.6k Points โ€ข 38 Badges
Abuja, Nigeria โ€ข lizdesigns.vercel.app
9Posts
20Comments
8Connections
API and devTools documentation writer. Learning frontend web development and exploring Agentic AI.

... Show more

Related Jobs

View all jobs โ†’

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!