JS Assets order in layout

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.