Can one function change the different variables that are put into it?
So I need one function to change each variable that is put into it. This is for a Choose Your Own Adventure Game and I need it to map each individual ending. My solution is to have a different variable for each ending and have it only work once, so the counter only goes up once, regardless of how many times that ending is reached. And yes, I know I am using document.write and document.open but those are what works best for me. (I don't think those are the problem) The code looks like this: let counterfour = true let counter = 0; function isFalse(theVar) { if(theVar) { theVar = false; counter = counter + 1; //Could be counter++ } else if(theVar === false) { //Nothing } } and then: function func4() { document.open(); document.write("You make it out safely. The next day, you read a newspaper article saying the theatre just experienced a brief power outage. You continue on with your life, still attending that theatre every week."); isFalse("counterfour"); addButton("The End!", "end"); }