โ† Back to all projects

Calculator

A fully functional calculator built with vanilla HTML, CSS, and JavaScript.

JavaScriptHTMLCSS

Published Fri Sep 25 2026

GitHub โ†’Live โ†’

A simple calculator built from scratch using vanilla JavaScript โ€” no frameworks, no libraries.

Features

  • Basic operations: addition, subtraction, multiplication, division
  • Percentage and delete buttons
  • Handles division by zero gracefully
  • Rounds floating-point precision issues (0.1 + 0.2 = 0.3, not 0.30000000000000004)
  • Clean dark UI with a modern color palette

What I Learned

  • DOM manipulation with querySelectorAll and addEventListener
  • State management using JavaScript variables
  • Using data-* attributes to clean up event handling
  • Handling edge cases and floating-point math