You are here: Home / Topics / Methods to include JavaScript in HTML Code?

Methods to include JavaScript in HTML Code?

Filed under: JavaScript on 2022-07-16 17:12:56

Javascript can be added to our HTML code in mostly 2 ways:

  • Internal Javascript: Javascript in this case is directly added to the HTML code by adding the JS code inside the <script> tag, which can be placed either inside the <head> or the <body> tags based on the requirement of the user.
  • External Javascript: In this case, the Javascript code is written inside an external file with the extension file_name.js, and then the file is linked to the HTML file inside the <head> tag.

About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.