Javascript example is easy to code. JavaScript provides 3 places to put the JavaScript code: within body tag, within head tag and external JavaScript file.

3 Places to put JavaScript code

  1. Between the head tag of html
  2. Between the body tag of html
  3. In .js file (external javaScript)
<!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>