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


<h2> This is heading tag </h2>

<p> This is paragraph tag</p>

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


alert(" Internal javascript ");

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



Try above code

2 - External javascript file

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

<DOCTYPE html>


<title> add external javascript file </title>

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



<h2> Use external javascript file </h2>

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



Try above code