Home  >  Article  >  Web Front-end  >  Where to put javascript

Where to put javascript

PHPz
PHPzOriginal
2023-04-06 08:57:111093browse

Where is JavaScript placed?

JavaScript is a programming language used for web front-end development, which can make web pages more dynamic and interactive. So, where do we put JavaScript?

  1. Internal script

In HTML documents, we can embed JavaScript code snippets in the or tags. This is the most common way for developers to write JavaScript code directly in HTML files. However, this will cause the HTML document to become bloated, which is not conducive to code management and maintenance.

  1. External script

External script is a method of placing JavaScript code in a separate JS file, using the