when trying to change the variable value its not changing although it is global:
let avg = 0
let total = 0
let courseNum = prompt("Enter the number of courses you have taken: ");
let CourseInt = parseInt(courseNum);
for (let index = 1; index <= CourseInt; index++) {
const courses = prompt("Enter the grade for course #" + index + ':');
for (let i = 0; i < courses.length; i++) {
if (parseInt(courses[i]) > 50) {
total =+ courses[i];
}
avg = total / courses.length;
}
}
prompt("YOUR AVG: " + avg)
</script>
in the prompt popup it shows that the avg is 0.