My $.extend does not seem to work when inside a function in javascript
<p>I have the following code:</p>

<pre><code>File 1:
$(document).ready(function () {
   addDataTableExts();
}

File 2:
function addDataTableExts() {
   $.extend($.fn.dataTableExt.oStdClasses, {
        sWrapper: 'no-margin last-child'
   }
}
</code></pre>

<p>This seems to work okay. I now tried to replace this with the following:</p>

<pre><code>File 2:
(function () {

    $.extend($.fn.dataTableExt.oStdClasses, {
        sWrapper: 'no-margin last-child'
    }
}
</code></pre>

<p>This doesn't work. </p>

<p>Is there some reason why it only seems to work if I do this the first way? I thought
that by changing the first line of File 2 then it would cause the code to get 
executed without me calling it.</p>
