I have this code:
var point = 2;
var change = function(){point = 5};
function makeChange(point,change){
change();
alert(point);
}
makeChange(point,change);
The idea is to give the user the ability to pass a condition for the value of point before using it in the function.
But it doesn't take effect.
When I add alert(point) into the change function it alerts 5 but then alerts 2 in the makeChange function.
pointand the global variablepointare two different variables. You are alerting the localpointinsidemakeChange. Basically just change the name of your first parameter to something other thanpoint.