172k views
3 votes
You are creating some Webpages for a project using a GUI HTML editor. Your supervisor directs you to collaborate with another developer to include JavaScript into several of the pages. How can you include this code in your pages?

User Hbabbar
by
6.4k points

1 Answer

4 votes

Answer:

Using a <script> tag.

Step-by-step explanation:

With the <script> tag you can add javascript code to your html.

The best way to do it is to link to a .js file this way

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

that way you can use the same file in many different pages.

There's also the possibility to put the js code directly into the html file like this

<script>

let a = "lalala";

/*your javascript code */

</script>

This is not considered a good practice since it would only work for one page, but it's one of the options available.

User MrKsn
by
5.5k points