I have the following code (Javascript):
var boolA = false;
var boolB = Math.random()*2 ? true : false;
I don’t know if boolB will be true or false, but I need to update boolA with it anyway every tick. Should I just update it or check if it was changed?
Which is fastest?
boolA = boolB;
or
if ( boolB != boolA ) boolA = boolB;
What about integers, strings and other objects?
Thank you in advance!
Straight assignment will always be fastest.