teaching_web_development

JavaScript

JavaScript is a versatile, high-level programming language primarily used for web development. It enables interactive web pages and is an essential part of web applications. Alongside HTML and CSS, JavaScript is one of the core technologies of the World Wide Web.

Resources

🛠️ Example code (practical)

<script type="text/javascript">
        document.write("<p> Hello from the world of Javascript</p>")
</script>  

<noscript> This browser does not support Javascript. Yikes!
</noscript>  
<script type="text/javascript" src="call.js">
</script>  

<noscript> This browser does not support Javascript. Yikes!
</noscript>  
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content = "width=device-width, initial-scale=1.0">
  <title> CSS and HTML practice </title>
  </head>

  <body>
    <header id ="main-header-page">
      <h1 class="title">
        Welcome to HTML!
      </h1>  
    </header>

    <main>
        <section class="content">
            <h2> This is a header </h2>
            <p> This is a paragraph </p>
            <a href="https://neelsoumya.github.io/" class="link">My webpage link</a>
        </section>        
    </main>    

    <script type="text/javascript">
        document.write("<p> Hello from the world of Javascript</p>")
    </script>  

    <noscript> This browser does not support Javascript. Yikes!
    </noscript>  

    <footer class="footer">
      <p> This is a test footer </p>
    </footer>   

  </body>  

</html>

Dialog box

alert("This is a dialog box")

Javascript fails silently

Useful commands

window.console & console.log("Hello from console")
x = 12 + "hello";
<script>
  gl = 123;

  function check(){
    var gl = 456;
  }

  check(); // call function

  console.log("Value of gl is:", gl);

</script>