If statement 'need better understanding of what is actually taking place'

my question is when i console.log(trueOrFalse(true)) does that mean i am making wasThatTrue = to true there for it returns the first statement? Also if that is the case when you console.log(trueOrFalse(false)) making wasThatTrue = to false is that like saying wasThatTrue is no longer wasThatTrue therefore the if statement sees if(wasThatTrue) as saying no it is not the same therefore you receive the second return statement?

i hope this makes sense i just want to understand a little better any answers are much appreciated thank you.

  **Your code so far**

function trueOrFalse(wasThatTrue) {
// Only change code below this line
  if(wasThatTrue) {
    return 'Yes, that was true';
  } 
    return 'No, that was false';
}


// Only change code above this line

console.log(trueOrFalse(false))
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0

Challenge: Use Conditional Logic with If Statements

Link to the challenge:

hello @C0ding-K1D welcome to the forum.

console.log(trueOrFalse(false))  //No, that was false
console.log(trueOrFalse(true))   //Yes, that was true

Every time you call for a function it runs on it’s own and posses own set of variables
the first call to trueOrFalse has the value of wasThatTrue set to false
and
the second call to trueOrFalse has the value of wasThatTrue set to true

when you call function with arguments it first assigns and then executes the statements inside that function
in this case if you pass values like false , “”, null, 0 , undefined, NaN

  1. wasThatTrue is assigned the value you passed
  2. checks the condition and return ‘No, that was false’
  3. function instance is disposed

you call the function again it repeats the steps from the very beginning and has nothing to do with previous call.