SOLVED - Delaying JS file load

Hi everyone.

I’ve been having problems solving the following thing.
So, I have an html file, which has an external JS file added. Now, I need the HTML file content to load first and after that execute the JS file.
I tried adding the script tag just before the body closing tag, but the JS file keeps running first.
Note: i need the html file to load first, because it has instructions on operating the JS file functions.

Specific advice would be helpful.


SOLUTION: I have came across, what I have learnt before, but couldn’t recall, so now I am using the setTimeout function to delay the execution of the JS file.
here is the code for further enquiries:
window.setTimeout(function(){}, delay);

Hope this helps anyone looking for this.

add your script tag as the last thing in your body. the script will run only after everything else