Topic 14: DOM - attaching JavaScript file in html

//Regular lecture 23: 31 Oct 2022

// Topic 14 //* DOM *//attaching JavaScript file in html//


Step 1) Create a folder
Step 2) Create a JavaScript file in that folder
Step 3) Write code in JavaScript file:

let A = "Sachin"
console.log(A)

let B = "Yuvraj"
console.log(B)

let C = "Dhoni"
console.log(C)

let D = ["tuljapur", "Solapur", "dharashiv"]
console.log(D)

Step 4) Create a html file in that folder
Step 5) Write code in html file:

<!DOCTYPE html>
<html>
    <head>
        <title>Google12</title>
    </head>
    <body>
        <h1>Sachin Tendulkar</h1>
    </body>
    <script src="JavaScriptFileName.js"></script>
</html>

Step 6) Copy path of html file
Step 7) Paste that path in address bar of browser and press Enter key
Step 8) html page will load. Then right click on page and select 'inspect'
Step 9) go to 'console' in inspect window
in that console you will see the output of code written in JavaScript file  
 

टिप्पण्या