DEV Community

Discussion on: JavaScript OR Assignment Operator

Collapse
 
acroynon profile image
Adam Roynon

I consider the standard or operator the one used in if statement, for boolean logic. Then the or assignment operator being used to assign values to variables (assign this value, if its falsey assign this value instead). I could be completely wrong in my phrasing, but I think it makes a nice distinction between the two use cases

Collapse
 
rubenswieringa profile image
Ruben Swieringa

You can consider a melon a nail when you hit it with a hammer, but it’s not going to make sense to anybody.

I’m afraid the long and short of it is just that the OR-assignment operator (||=) is not the OR-operator (||), sorry man.

Thread Thread
 
acroynon profile image
Adam Roynon

Okay, thanks for the clarification