<script> Element

  • Used to define JavaScript within the document
  • Can contain script statements, or
  • Can refer to an external script file via the src attribute


<!DOCTYPE html>
		<title>My Document Title</title>
			document.write("Hello, World!");
		<script src="/js/myJavaScript.js"></script>


Save & refresh browser:

Hello, World!


*note: if defining an external src file the script element must be empty.

Leave a Reply