# What's the purpose of invoking an inline function?

**URL:** https://forum.kirupa.com/t/whats-the-purpose-of-invoking-an-inline-function/313484
**Category:** web dev
**Created:** [August 31, 2010, 8:09pm UTC](https://forum.kirupa.com/t/whats-the-purpose-of-invoking-an-inline-function/313484 "2010-08-31T20:09:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)
#### Post date: [August 31, 2010, 8:09pm UTC](https://forum.kirupa.com/t/whats-the-purpose-of-invoking-an-inline-function/313484/1 "2010-08-31T20:09:32Z")

</div>

The [Facebook API](http://developers.facebook.com/docs/reference/javascript/) suggests that I load their source files with this:

```php

(function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());

```

I’ve also seen some Google API’s invoke an inline function. What’s the point? Why not just leave out the function declaration and invocation and just run the code inside by itself?
