It means 'or'. In this instance it assigns the value of $(el).data('start')
to the variable time
or, if that doesn't exist or instead returns false
, it assigns instead the value returned from new Date()
. Or, as more clearly noted by Malovolio, in comments:
...if $(el).data('start')
is "falsy" (that is, undefined, null, 0, false, an empty string, or NaN), then new Date()
is evaluated and assigned to time
.
The important aspect of a logical operator:
Logical operators are typically used with Boolean (logical) values; when they are, they return a Boolean value. However, the && and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value.
References: