Is this a shorthand if else statement?
var _docWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth;
If not, what is this variable saying?
Is this a shorthand if else statement?
var _docWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth;
If not, what is this variable saying?
variable = (condition) ? trueValue : falseValue;
In longhand it is:
if (condition) {
variable = trueValue;
} else {
variable = falseValue;
}
It’s called the ternary operator, and that’s exactly what it is.