Retour aux Projets

JS Simple Calculator

A browser-based calculator built with HTML, CSS, and JavaScript for basic arithmetic operations with dark mode support.

2023

Durée

Jul 2023

Taille de l'équipe

1 personnes

Technologies

3+ tech

JS Simple Calculator

Aperçu du Projet

A simple calculator web application built with pure HTML, CSS, and JavaScript. It supports the four basic arithmetic operations — addition, subtraction, multiplication, and division — with a clear display showing the current expression. The interface is responsive and includes a dark mode for comfortable use in low-light environments.

Fonctionnalités

  • Basic arithmetic — addition, subtraction, multiplication, and division
  • Expression display showing the full current input and result
  • Clear (AC) and delete (⌫) controls for correcting input errors
  • Responsive design for optimal viewing on desktop and mobile
  • Dark mode for reduced eye strain during night-time use

Défis

  • Handling edge cases like consecutive operators or division by zero gracefully
  • Displaying the running expression clearly without cluttering the UI
  • Keeping the implementation clean in pure JavaScript without relying on eval()

Solution

Built a simple expression parser that validates operator sequences and catches division by zero with a user-friendly error message. CSS custom properties handle the dark/light toggle. All logic is explicit JavaScript — no eval().

Architecture

Single-page vanilla JavaScript app. A state object holds the current operands and operator. Button event listeners update state and re-render the display. CSS custom properties control theming.

Résultats & Impact

  • Live demo available via GitHub Pages
  • Clean, readable pure JavaScript implementation without eval()
  • Handles common edge cases like division by zero gracefully
Technologies

Frontend

HTMLCSSJavaScript

Backend

Base de données

Outils

GitGitHub Pages
Équipe
  • Ismail ZAHIR
Licence
MIT

Libre d'utilisation, modification et distribution avec attribution.

Tags du Projet
HTMLCSSJavaScript

Plus de Projets

NexoWorld
2024
An AR mobile game where players explore real-world locations to earn in-app currency and complete challenges — built on a Spring Boot microservices backend with real-time location sync.
Spring BootFlutterMongoDB+5
Kolchi.ma
2024
A full-featured Moroccan e-commerce and repair marketplace connecting buyers, sellers, and service providers on a polyglot microservices platform with real-time messaging.
DotNet CoreSpring BootNestJS+6