17 May 2019

Logical OR Assignment

The syntax is as follows:

variable ||= value

This is equivalent to writing:

variable = variable || value

Works in JavaScript and Ruby.