I'm facing a scenario with a simple if statement structured like this:
if (gl.Node.moveUp.call(this) && this.parent._currentScene()) {
// Perform an action
}
Both functions are designed to return boolean values. Does JavaScript evaluate this condition sequentially?
The function gl.Node.moveUp
modifies something within the object where it's invoked, and I want this operation to occur even if _currentScene
returns false.
For example, in pseudo code if the result of the condition were as follows:
if (true && false) {
}
Would the call to gl.Node.moveUp
still be executed and modify the relevant object? Or does JavaScript reverse the changes due to the overall condition being false?
Is it recommended to split this into two separate if conditions like shown below?
if (gl.Node.moveUp.call(this)) {
if (this.parent._currentScene()) {
}
}