+ 2

placing js at the end of body tag allows the web page to load faster.. does this mean <script> should come after </body> for pag

ex:........ ........</body> <script>...</script> </html> like this?

20th Dec 2017, 8:56 AM
Archana
1 Answer
+ 5
Within SoloLearn, I have been putting all my JavaScript on the 'JS' tab in code playground. I then have this: window.onload = function(){ // script goes here } The above approach makes it a lot easier to maintain both your HTML and JavaScript as you keep them separate. The window.onload will wait for the HTML to load before running the script.
20th Dec 2017, 11:21 AM
Duncan
Duncan - avatar