# JS Assets order in layout

**URL:** <https://discourse.cakephp.org/t/js-assets-order-in-layout/11681>\
**Category:** Need Help\
**Created:** [November 15, 2023, 8:37am UTC](https://discourse.cakephp.org/t/js-assets-order-in-layout/11681 "2023-11-15T08:37:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lamine](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@Lamine](https://discourse.cakephp.org/u/Lamine)\
**Post date:** [November 15, 2023, 8:37am UTC](https://discourse.cakephp.org/t/js-assets-order-in-layout/11681/1 "2023-11-15T08:37:47Z")

</div>

In layout/default.php I moved ‘\<?= $this-\>fetch(' script') ?\>’ from head tag to right before the closing body tag to have scripts files rendered there.

I was expecting to have the assets linked inside default.php at top order of rendered js files before the other js files from other view templates, but The opposite is what happens… Any guidance.
