JavaScript File Use

There are two ways to use JavaScript file

1- Internal use of javascript

2-External use of javascript

1 - Internal use of javascript mean javascript code write inside html file .

Example 01

<body>

<h2> This is heading tag </h2>

<p> This is paragraph tag</p>

<!---*************** Use internal javascript file *******--->

<script>

alert(" Internal javascript ");

console.log("hey really it is working");

</script>

</body>

Try above code

2 - External javascript file

first create a javascript.js file then attached with script tag

<DOCTYPE html>

<head>

<title> add external javascript file </title>

<script src="javascript.js"></script>

</head>

<body>

<h2> Use external javascript file </h2>

<p> You can also attached before the end of body tag</p>

</body>

</html>

Try above code