I understand that JS does a pre-compilation of functions before it executes code. So function order does not matter. But, function order somehow becomes a problem when linking \*.js files.

For example,

```
<script src="@Url.Content("~/Scripts/Personal/MyJScript.js")" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        hello();
        afterCall();
        hello2(); //fails, defined in MyJScript2.js

    });

    function afterCall() {
        alert('inline function defined after call');
    }
</script>

<script src="@Url.Content("~/Scripts/Personal/MyJScript2.js")" type="text/javascript"></script>

```

In the code above, the function `hello2()` is defined in a file that is linked after the call is defined. The call fails. So, intuitively I assume now function order *does* matter in this case. 

Considering I perform `$(document).ready`, the document should be as ready as it gets. So, why does this happen?

---

As requested, here is the client side HTML

```
<body>
    <script src="/Scripts/Personal/MyJScript.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        hello();
        afterCall();
        hello2(); //fails

    });

    function afterCall() {
        alert('inline function defined after call');
    }
</script>

<script src="/Scripts/Personal/MyJScript2.js" type="text/javascript"></script>

</body>

```