I'm building a calculator. Why is the addToStr function not able to change the values of the global variables? (I sampled just some switch-statement cases to shorten the code).
window.onload = function () {
$(".buttons").click(function () {
    var id = $(this).attr("id");
    switch (id) {
        case "b-7":
            value = "7";
            console.log(value);
            addToStr(miniDisplayString, value);
            addToStr(numberString, value);
            break;
        case "b-8":
            value = "8";
            addToStr(miniDisplayString, value);
            addToStr(numberString, value);
            break;
        case "b-9":
            value = "9";
            addToStr(miniDisplayString, value);
            addToStr(numberString, value);
            break;
        case "b-divide":
            value = " / ";
            addToStr(miniDisplayString, value);
            break;
    }
    console.log("total = " + total);
    console.log("miniDisplayString = " + miniDisplayString);
    console.log("numberString = " + numberString);
});
}
var total = 0;
var value;
var miniDisplayString = "";
var numberString = "";
function addToStr(tot, val) {
     tot += val;
}
 
    