# Self invoking anonymous functions

**URL:** https://forum.kirupa.com/t/self-invoking-anonymous-functions/328407
**Category:** web dev
**Created:** [May 15, 2012, 8:52am UTC](https://forum.kirupa.com/t/self-invoking-anonymous-functions/328407 "2012-05-15T08:52:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)
#### Post date: [May 15, 2012, 8:52am UTC](https://forum.kirupa.com/t/self-invoking-anonymous-functions/328407/1 "2012-05-15T08:52:44Z")

</div>

Hello.

'just watched a lee brimlow screencast about OOP in javascript. Great for AS3 peeps moving to javascript btw.

Now in it he declares a SIAF like so:

```auto
(function() {
// code
}());

```

I have been using this method - which I have got from having my head in jQuery:

```auto
(function() {
// code
})();

```

spot the difference - the latter makes sense to me, where as lee’s approach, baffles me a little.

Can anyone clarify his method?  
ps this is not about jQuery - but basic JS.

Thankyov’
