This JavaScript project, part of the freeCodeCamp JavaScript Algorithms and Data Structures certification, simulates a cash register function. It calculates change for transactions, handling various US currency denominations.
Key Features:
- Accurate change calculation based on purchase price and payment
- Handles multiple US currency units (penny to $100 bill)
- Assesses cash drawer status and returns appropriate messages
Technical Details:
- Implemented in JavaScript
- Core function:
checkCashRegister(price, cash, cid)
- Returns object with status and change array
Challenges Overcome:
- Implemented in JavaScript
- Core function:
checkCashRegister(price, cash, cid)
- Returns object with status and change array
Challenges Overcome:
As a blind developer, I faced several challenges in this project:
- Floating Point Precision: JavaScript’s handling of decimal numbers caused unexpected results. I implemented rounding techniques to ensure accurate calculations.
- Regular Expressions: While not extensively used in this project, working with regex in JavaScript has been an ongoing learning process for me.
- JavaScript Complexity: Navigating complex JavaScript logic, especially with nested conditions and array manipulations, required careful planning and testing.
Accessibility Considerations:
The CSS for this project was provided by freeCodeCamp, which significantly eased the development process. As a blind developer, working with CSS can be particularly challenging, so having it pre-written allowed me to focus entirely on the JavaScript logic. This experience highlighted how pre-designed CSS can enhance project accessibility for developers with visual impairments.
I ensured the JavaScript logic was clean and well-commented, improving code readability and enhancing overall accessibility for other developers who might use screen readers.
Learning Outcomes:
- Improved skills in handling financial calculations in JavaScript
- Enhanced understanding of data structure manipulation
- Developed strategies for overcoming floating-point precision issues
- Gained appreciation for the role of pre-written CSS in improving project accessibility for visually impaired developers
This project demonstrates my ability to tackle complex programming challenges, adapt to language-specific quirks, and create functional solutions while considering accessibility. It also underscores the importance of collaborative and inclusive development practices in web development.