I'm currently learning to develop javascript/jquery plugins and I've noticed many of them have the following syntax:
var pluginName = window.pluginName || {};
I'm having a hard time understanding what this means, specifically the OR curly braces part. If someone could shed light on what this means in the context of the code then that would be great.
That translates to:
var pluginName;
if (window.pluginName) {
pluginName = window.pluginName;
} else {
pluginName = {};
}
See for more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators