While reading an article on special events in jQuery, I came across a syntax that was unfamiliar to me:
var threshold = data && data.threshold || 1
I have previously encountered the following:
var threshold = data.threshold || 1
As far as I know, this means: assign the value of data.threshold
or if it is null
, then assign 1
. Could someone please explain the first syntax to me?