JavaScript JavaScript Basics Hello, JavaScript! Write JavaScript Statements

Diquan Richard
Diquan Richard
365 Points

How do we link two different programs together I tried <script src="myJSfile.js"></script)

I tried using .js and .html toward the end of the code to see If I can link them but I keep getting an error.

index.html
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
<script src="myJSfile.js"> 
    </script> 
  </body>
</html>
app.js
<script src="myJSfile.html"></script> 

1 Answer

Blake Larson
Blake Larson
12,906 Points

No need to declare anything in the JS file. if it's declared at the bottom of the html body then you are good to go.

<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
  <script src="app.js"> </script> 
  </body>
</html>