JavaScript + Node.js track

Part 1 · Mini Projects (Workbook)

BMI Calculator / Leap Year Checker

BMI Calculator / Leap Year Checker — Mini Projects (Workbook) in the free JavaScript + Node.js track, covering Console, Math, Conditionals.

Mini Projects (Workbook)1 min readFree lesson

Project brief

Build two small console programs: a BMI calculator and a leap-year checker. Both exercises focus on arithmetic, comparison and conditional branches.

This is a workbook project in the JavaScript track. It has no single prescribed solution: build it in your own file, test it in the browser or Node, and compare your result with the checklist below.

What you will practise

  • Console
  • Math
  • Conditionals

Build it step by step

  1. Ask for a height in metres and a weight in kilograms, then compute BMI as weight divided by height squared.
  2. Print the numeric BMI and the matching category (underweight, healthy range, overweight, obese).
  3. Write a second script that reads a year and reports whether it is a leap year using the divisibility rules.
  4. Test both programs with normal values, boundary values and invalid input.

Stretch goal

Add one feature that is not in the list above, then write down why you chose it and what you had to change. Keep the feature small enough to finish in one sitting.

Before you move on

  • The project runs without errors in a fresh browser tab or Node process.
  • Empty, missing and invalid inputs are handled deliberately.
  • The code is split into small functions with clear names.
  • You can explain every line you wrote.

Topics: Console, Math, Conditionals.

Assignment

Requirements

  • Use const/let and avoid var.
  • Validate that height and weight are positive numbers.
  • Round the BMI to one decimal place.
  • Explain each conditional branch with a short comment.

Acceptance checklist

  • The happy path works end to end.
  • Invalid input produces a useful message, not a crash.
  • The code is readable and consistently formatted.
  • You have tested at least three different inputs.

Submission

Keep the project in a folder named after the project. Include a short README.md with run instructions and one paragraph describing what was hardest.

Learn this lesson with a mentor

Work through the JavaScript + Node.js track on your own, or join a guided cohort at our Pitampura campus and online.

Call NowEnroll Now