Message from JavaScript discussions

February 2019

— He's calling logic function with passed parameter when button is clicked


The problem here is the conditional is called as son as the event trigger is set. It’s almost instantaneous.

— Yeah it will be called

— And if it is called

— 0 is returned

— X is storing 0

— Which makes if(x) false

— If button clicked

— No, it’s not.

— And it is not executed

— If either button is not clicked then x is 1

— Yes he's making it default