I made a 'colorChange' function outside the 'showBall' function and i want to use 'colorchange' function inside the 'showBall' function but span is not defined..
function colorChange(standard, color) {
if (standard > 10) {
span.style.color = color;
}
}
const showBall = (number, $target) => {
const span = document.createElement("span");
span.className = "ball";
span.innerHTML = lotto[number];
colorChange(lotto[number], "red");
$target.append(span);
};