What does the construct x = x || y mean?
I am debugging some JavaScript and can’t explain what this || does: function (title, msg) { var title = title || ‘Error’; var msg = msg || ‘Error on Request’; } Why is this guy using var title = title || ‘ERROR’? I sometimes see it without a var declaration as well. 12 Answers 12