👤

Vreau sa fac un calculator, invat javascript
codul HTML:




Calculator








0
1
2
3
4
5
6
7
8
9
C
+
-
*
/
=






codul javascript: function getTheNumberZero() {
let numberZero = 0;
let input = document.getElementById("myInput");
input.value += numberZero;
}
function getTheNumberOne() {
let numberOne = 1;
let input = document.getElementById("myInput");
input.value += numberOne;
}
function getTheNumberTwo() {
let numberTwo = 2;
let input = document.getElementById("myInput");
input.value += numberTwo;
}
function getTheNumberThree() {
let numberThree = 3;
let input = document.getElementById("myInput");
input.value += numberThree;
}
function getTheNumberFour() {
let numberFour = 4;
let input = document.getElementById("myInput");
input.value += numberFour;
}
function getTheNumberFive() {
let numberFive = 5;
let input = document.getElementById("myInput");
input.value += numberFive;
}
function getTheNumberSix() {
let numberSix = 6;
let input = document.getElementById("myInput");
input.value += numberSix;
}
function getTheNumberSeven() {
let numberSeven = 7;
let input = document.getElementById("myInput");
input.value += numberSeven;
}
function getTheNumberEight() {
let numberEight = 8;
let input = document.getElementById("myInput");
input.value += numberEight;
}
function getTheNumberNine() {
let numberNine = 9;
let input = document.getElementById("myInput");
input.value += numberNine;
}
function clearFunction() {
let input = document.getElementById("myInput");
input.value = '';

}
let input = document.getElementById(myInput);
let firstValue = input.value
let secondValue = input.value
function add() {
let sum = firstValue + secondValue;
}
function calculate() {
input.value = sum;
} Nu înțeleg de ce nu merge functia add si calculate, nu stiu unde gresesc?