Given this snippet of JavaScript...
var a; var b = null; var c = undefined; var d = 4; var e = \'five\'; var f = a || b || c || d || e; alert(f); // 4
See short-circuit evaluation for the explanation. It's a common way of implementing these operators; it is not unique to JavaScript.