What is the consequence of this bit of javascript?
javascript, jquery, jquery-ui
Solution
why is there a semicolon before jQuery?
The semi-colon is there to ensure safe file concatenation. (libraries and library components are frequently packed into a single file)
why is the logical OR being done?
The self-invoking anonymous function on the right hand-side will only run if the left-hand-side of the statement evaluates to a falsey value. So if `jQuery.ui` already exists on the page then the function will not run. It only runs when `jQuery.ui` does not yet exist.
Problem
I was looking at the jQuery UI code, and I found that every file starts with a construct like this: ``` jQuery.ui || (function($) { ``` My question is: why is there a semicolon before `jQuery`, and why is the logical OR being done?