Only need one dot for the calculator to function properly. The current situation with multiple dots is causing confusion. I intend to address other aspects of the code later, but I'm currently struggling with this issue.
function dec(d) {
let display = document.getElementById('display');
let displayArray = display.innerHTML.split("");
displayArray += d.innerHTML;
display.innerHTML = displayArray;
if (!displayArray.includes(".")) {
displayArray += ".";
displayArray = display;
}
I have experimented with various solutions, but I'm still unable to resolve this.
I am looking to have a single dot, without the current issue where there is ",." added with each dot click
I understand that the problem lies within working with arrays, splitting the array, or similar operations, but I am struggling to pinpoint the exact issue.