Javascript code

How can I segment the code and move certain functions into other files to make it easier to read? I want to call these functions from the main html file.

Hello @tumzim, greetings
You create a separate ‘yourFile.js’ file, for now you have that file in the same directory/folder for easier reference. You move javascript related code in there. Then, in you main html file, you import (in the html head tags) that .js file like this:

...
<script src="yourFile.js"></script>
...

Hope the information is helpful to you.
With kind regards

1 Like