How to include a Javascript file in another Javascript file

Hi guys! In this tutorial I will explain to you how you can include a Javascript file in another Javascript file without using <javascript> tags.

If you want to include a Javascript file in another, you can do it by using this code:

var a = document.createElement("script"); // by using this code I will create the Javascript tags.

a.src = "js.js"; // now I will include the file js.js

Then I will use this code:

document.body.appendChild(a);

In this way you can include a Javascript file in another Javascript file!

Video tutorial:









Leave a Comment