JS Implementation


Javascript in <head>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript</title>
    <script>
        document.write("Hello from Yahoo Baba");
    </script>
</head>
<body>
    <h1>Hello</h1>
</body>
</html>


Javascript in <body>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript</title>
</head>
<body>
    <h1>Hello</h1>
    <script> 
        document.write("Hello from Yahoo Baba");
    </script>
</body>
</html>


External Javascript File

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript</title>
   <!-- External JavaScript -->
    <script src="js/test.js"></script> 
</head>
<body>
    <h1>Hello</h1>
</body>
</html>


test.js file code

// test.js file
document.write("Hey Hello Again");