Files
week2-day4/README.md
2026-04-07 17:42:22 +00:00

1.1 KiB
Raw Blame History

Week 2 Day 4 Smart Number Analyzer

Project Overview

This project is an advanced version of the Number Analyzer app. It uses functions and event handling to create a modular and maintainable JavaScript application.

Features

  • Modular code using functions
  • Even, Odd, and Prime detection
  • Dynamic UI update
  • Clean and reusable logic

Tech Stack

  • HTML5
  • CSS3
  • JavaScript

How It Works

  1. User enters a number

  2. Clicks Analyze

  3. handleAnalyze() triggers

  4. generateAnalysis() runs loop

  5. Helper functions:

    • isEven()
    • isPrime()
  6. Output displayed on UI

Key Concepts Used

  • Functions
  • Parameters & return values
  • Event handling
  • Code modularization
  • Nested logic

Output Example

Input: 5

1 - Odd 2 - Even | Prime 3 - Odd | Prime 4 - Even 5 - Odd | Prime

Total Even Numbers: 2 Total Odd Numbers: 3 Total Prime Numbers: 3

Future Improvements

  • Optimize prime logic (√n)
  • Add UI enhancements
  • Add reset button
  • Add animations

Learning Outcome

  • Writing clean, structured code
  • Breaking problems into functions
  • Understanding event-driven programming