My calculator works with one operator for example 1 + 1 but not with 1 + 1 * 5
Right now if I do 1 + 1 then if I press * its gonna calculate 1 + 1 and display it, and then when i press 5, its just gonna display 25 when it should display 5. It's adding the number pressed to the result of the first calculation and i dont know how to fix it.
i already tried doing
if (result != null) display.textContent += number.innerHTML;
but i cant do that because then the display is gonna duplicate