CHEUNG-K-Jeffrey / freeCodeCamp-Certification-Projects

MIT License
0 stars 0 forks source link

New freeCodeCamp Project: JavaScript Calculator #10

Closed CHEUNG-K-Jeffrey closed 1 year ago

CHEUNG-K-Jeffrey commented 1 year ago

I did the minimal setup for the JavaScript Calculator project.

The project requirements need to met.

Here is the list of project requirements: Objective: Build an app that is functionally similar to this: https://javascript-calculator.freecodecamp.rocks/.

Test suite: https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js

CHEUNG-K-Jeffrey commented 1 year ago

This time I'm going to build the app with Vue.js. Maybe Vue.js will be easier than React.js?

CHEUNG-K-Jeffrey commented 1 year ago

I'm going to use vue3-sfc-loader, which allows using .vue aka Single-File Components from HTML. It doesn't require the use of a build system and makes it run in the browser. I thought I was going to give up using Vue.js and go with what I did with the Drum Machine project.

CHEUNG-K-Jeffrey commented 1 year ago

The UI looks decent, but the architecture needs to be redesigned with state management like Pinia to make the calculator function.

CHEUNG-K-Jeffrey commented 1 year ago

According to the freeCodeCamp JavaScript Calculator Test Suite, it passes. But as of commit 7b4154d, my calculator doesn't actually handle using a result with a negative number very well. It bugs out and throws errors. This shows how comprehensive the freeCodeCamp test suite can be, not that it's comprehensiveness matters as I'm mostly using freeCodeCamp for coding practice in JavaScript.

The bug could be fixed by adding a check for negative numbers on the result and returning for example: [0,"-","9"] It will display 0-9 with the fix, and the display getter would need to be rewritten to hide the 0-.

CHEUNG-K-Jeffrey commented 1 year ago

The bug could be fixed by adding a check for negative numbers on the result and returning for example: [0,"-","9"] It will display 0-9 with the fix, and the display getter would need to be rewritten to hide the 0-.

Fixed with a2abc72

CHEUNG-K-Jeffrey commented 1 year ago

I fixed a bunch of bugs not on the test suite. I'm done with this project. The architecture is good enough for this simple calculator.