It is local to the function. Let’s test it to make sure.
function minusSeven(num) {
// let's change num's value
num = num - 7; // num is now 5
return num;
}
var num = 12;
console.log(minusSeven(num)); // displays 5
console.log(num); // display 12;
The var num = 12; in the global scope is unaffected by the change to num in the local scope of the function.
oh that’s a gd idea lol. I didn’t even think of testing it like that.
Hey, did you run that test in a code editor or does the forum have a way to do that?