This website is a calculator, here you will be able to add, subtract, multiply and divide the math you need to do.
The users should be able to:
- Add, subtract, multiply and divide the math.
- See the display with numbers clicked.
- View the optimal layout depending on their device's screen size.
- Semantic HTML5
- Flexbox
- JavaScript
- Conditional
- Object orientation
- Metods
- Classes
- Events
- Ternary conditional
How create metods, classes and constructor. For the first time i used object orientation in my projects.
class Calculator {
constructor(previewDisplayText, actualDisplayText) {
this.previewDisplayText = previewDisplayText;
this.actualDisplayText = actualDisplayText;
this.clear();
}
calculate () {
let result;
const _previewDisplay = parseFloat(this.previewDisplay);
const _actualDisplay = parseFloat(this.actualDisplay);
if (isNaN(_previewDisplay) || isNaN(_actualDisplay)) return;
switch (this.operator) {
case "+":
result = _previewDisplay + _actualDisplay;
break;
case "-":
result = _previewDisplay - _actualDisplay;
break;
case "/":
result = _previewDisplay / _actualDisplay;
break;
case "*":
result = _previewDisplay * _actualDisplay;
break;
default:
break;
}
I will developer my projets using OOP to better knowledge and practice.
This resource helped me a lot to understand how to do to implemented JS. https://www.w3schools.com/ https://developer.mozilla.org/en-US/ https://stackoverflow.com/
- Linkedin - https://www.linkedin.com/in/helcio-anicio/
- Vercel - https://vercel.com/helcioanicio