by jashkenas · 14y ago · 0 comments
"or=" is the same as "||=", and means: Assign the variable on the left to the value on the right if the variable is falsy.
"?=" means: Assign the variable on the left to the value on the right if the variable does not yet exist (ie. is either "null" or "undefined").
Two different things, both useful.
if a? then a else 0
becomes either a ?: 0 (if you like groovy)
or a // 0 (if you like perl)