What does the || operator do?
var time = $(el).data('start') || new Date();
This is an
OR operator. What you need to understand is:
Non-boolean values are converted to a boolean when used in a logic operator. Values that convert to
false are called "falsy" and values that convert to
true are called "truthy". Falsy values include things like
OR operator short-circuits: it keeps evaluating expressions until it finds on that is
true, and then stops.
var time = $(el).data('start') || new Date(); means "set
time to the
start data of the
el element, OR, if that's falsy, use the current time".