JavaScript JavaScript Basics Introducing JavaScript Link to an External Script

Jose Gutierrez
Jose Gutierrez
1,029 Points

what is proper syntax to source .js in html file?

what is proper syntax to source .js in html file?

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script> = "shout.js";
  </script>
</body>
</html>
shout.js

1 Answer

Elijah Quesada
Elijah Quesada
Front End Web Development Techdegree Graduate 25,265 Points

You need to add the src attribute inside the first script tag and set it equal to "shout.js".

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script src="shout.js"></script>
</body>
</html>