how old are these tutorials? in the function sum1_100, the variable sum is defined in the for loop and local to that.
accessing it will outside the loop will return ReferenceError
it should be rewritten like this
function sum1_100(){
let sum = 0;
for (num=1;num<=100;num++){
sum+=num;
}
return sum;
}
how old are these tutorials? in the function sum1_100, the variable sum is defined in the for loop and local to that.
accessing it will outside the loop will return ReferenceError
it should be rewritten like this