Posts

Showing posts from September, 2022

Linking your JavaScript file

Linking your JavaScript file   JavaScript has another name—ECMAScript. When you write JavaScript, you should write them in a JavaScript file that ends with a  .js  extension. Doing so allows you to use the same set of JavaScript code across all your HTML files. These JavaScript files can be named anything you want. Most people name their first JavaScript file either  app.js  or  main.js . These files are then stored in a  js  folder that’s located at the same level of your HTML files for easy identification. Linking your JavaScript file to your HTML file. For your JavaScript files to work, you need to link them to your HTML. You do so by adding a  <script>  tag at the bottom of your HTML, before closing the  </body>  tag. This  <script>  tag should contain a  src  attribute that points to your JavaScript file, like this: <html> <head> <meta charset="utf-8" /> <title...