Essentially, it is a programming language for web pages. So, we use JavaScript to make a web page interactive.

Basically, JavaScript is an interpreted language used in creating web pages. Furthermore, we can use it both on client side as well as server side. JavaScript also has object-oriented features. It means that we can create our own classes and objects. Also, the language offers many built-in objects such as String, Math, Date, document, window, and so on.

The following code shows an example of using JavaScript in an HTML document.

<html>
 <head>
    <title>Using JavaScript</title>
    <script>
      function set(){
	document.getElementById("d1").innerHTML=new Date();
       }
    </script>
 </head>
 <body>
    <center>
        <div id="d1"></div>
        <button onclick="set()">Get Date</button>
    </center>
 </body>
</html>

Output

Using Client Side JavaScript in a Web Page
Using Client Side JavaScript in a Web Page

Further Reading

Evolution of JavaScript from ES1 to ES2020

Introduction to HTML DOM Methods in JavaScript

JavaScript Practice Exercise

programmingempire