var globalVariableWhichHoldsANumber = 0;

function addOneToThisVariable(someNumber) {
        someNumber = someNumber + 1;
        return someNumber;
}


function addingToAGlobalVariable() {
        globalVariableWhichHoldsANumber = globalVariableWhichHoldsANumber + 1;
        globalVariableWhichHoldsANumber = addOneToThisVariable(globalVariableWhichHoldsANumber);
        globalVariableWhichHoldsANumber = globalVariableWhichHoldsANumber + 10 ;
}




function addUpAGlobalVariableSeveralTimes() {
	globalVariableWhichHoldsANumber = 0;
	addingToAGlobalVariable();
	addingToAGlobalVariable();
	addingToAGlobalVariable();
	alert('I expect this to be 36 and it is: ' + globalVariableWhichHoldsANumber);
}

addUpAGlobalVariableSeveralTimes();








function addingToAGlobalVariable2(globalVariableWhichHoldsANumber) {
	globalVariableWhichHoldsANumber = globalVariableWhichHoldsANumber + 1;
	globalVariableWhichHoldsANumber = addOneToThisVariable(globalVariableWhichHoldsANumber);
	globalVariableWhichHoldsANumber = globalVariableWhichHoldsANumber + 10 ; 
        return globalVariableWhichHoldsANumber;
}



function addingUpAGlobalVariable2() {
	globalVariableWhichHoldsANumber = 0;
	globalVariableWhichHoldsANumber = addingToAGlobalVariable2();
	globalVariableWhichHoldsANumber = addingToAGlobalVariable2();
	globalVariableWhichHoldsANumber = addingToAGlobalVariable2();
	alert('I expect this to be 36 but it is not: ' + globalVariableWhichHoldsANumber);
}
addingUpAGlobalVariable2();