When HTML page is open, I can call javascript function with many ways.(automatically)  

`onpageshow`, `onload`, `$(function() {...} );`, only simple line function, etc..

I want to know what are different and sequence of them.  

(Recently, I understand `onload` don't called if the page is caching, so i change it `onpageshow`).

[Number] in under code is the sequence that I expected.

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body onpageshow="onPageShow();" onload="onLoad()">

<script type="text/javascript">
  console.log("[1] - simple function");

  function onPageShow() {
    console.log("[2] - onPageShow()");
  }

  function onLoad() {
    console.log("[3] - onLoad()");
  }

  $(function() {
    console.log(`[4] - $(function(){})`);
    // same with document.onload, maybe
  });
</script>
</body>
```