DEV Community

Jinhoo Bong
Jinhoo Bong

Posted on

HTML/JS File loads

[HackReactor W2D2]
Given two files, an init.js and an HTML file - we were supposed to correctly line up how the files would be loaded/executed.

I had 24 failed attempts lol.

The browser should begin by loading up the HTML file. Then looking at the next couple of lines in the

section of the file, we would load the 'styles.css', a jQuery CDN, and then two local js files (which I believe are also executed at the same time they are loaded).

Then looking in the

, we notice there is an 'init.js' file in which a jQuery .ready() function is defined. After doing some research, my understanding is that all of the code inside the .ready() is loaded before any of the elements on the HTML file are loaded. Then we would finish executing that and now render any remaining HTML elements.

And then once an action is handled on the page, it would invoke the code inside the 'init.js' file following whatever code lied inside. But I guess there is some flaw with how I'm understanding how the computer would load these files in. I've yet to discover how it runs, but I will (hopefully) understand it soon.

Top comments (0)