By executing the following code, we will get true twice in the console:
var booltestvar = true; function testFunc1(){ otherFunc(booltestvar) } function otherFunc(booltestvar){ if (booltestvar === true){ console.log("true") booltestvar = false; } else {console.log("Уже не true")} } testFunc1(); testFunc1(); otherFunc does not need a parameter: booltestvar so visible inside it, since it is defined on the outer level. Therefore, if we remove the parameter from otherFunc , the second output to the kosol will be Уже не true .
Did I understand correctly that the value of a function parameter, if it exists, cannot be changed within the function itself and used when the function is called again? In any case, I ask you to comment on the results of the experiment.