How to link javascript file to a HTML file ? Ans: with the script tag inside your HTML <head >tag before <body >.. Example: Now if I change anything in my spyTest.js file which is present inside my project folder it will reflect to project HTML page. <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Javascript</title> <!-- Too link Javascript with HTML page --> <script src="spyTest.js"></script> </head> <body> <h1>Playing with Javascript</h1> </body> </html>