A retro-themed calculator that demonstrates core JavaScript principles. This project simulates a "faulty" calculator where results can be intentionally incorrect, showcasing a fun application of conditional logic, DOM manipulation, and a touch of randomness.
- Core JavaScript Logic: The calculator utilizes JavaScript to handle user input, perform calculations, and implement its unique logic. For every calculation, the program generates a random number. If the number is less than or equal to
0.5, it returns a slightly incorrect result, demonstrating a playful application of conditional logic. If the number is greater then0.5, the correct result is displayed. This random number is generated in the background and is not visible to the user. - DOM Manipulation: JavaScript is used to dynamically update the result display and show error messages based on user actions and calculation outcomes.
- Event Handling: The calculator uses event listeners on buttons to trigger functions for calculation and resetting the interface.
- Modern CSS: The interface is styled with a modern, retro-inspired theme using Google Fonts and a dark color palette. The layout is responsive, ensuring usability on both desktop and mobile devices.
- Robust Error Handling: The JavaScript includes checks for invalid number inputs, incorrect operators, and prevents errors like division by zero.
- HTML5
- CSS3
- JavaScript (ES6+)
Simply clone this repsitory to your local machine and open the index.html file in your web browser.