This is a simple JavaScript Program to show Date and Time Stamp on a webpage. In this script  we define a JavaScript function named getFormattedDateTime. This function uses the Date object to get the current date and time. It then formats them into a human-readable string.

The we define event listener that waits for the HTML document to be fully loaded before executing the provided function. Inside the event listener function, we call getFormattedDateTime to get the formatted date and time. Then, we create a new paragraph element (<p>) using document.createElement('p'). We set the text content of this paragraph to include the message “Page loaded on:” followed by the formatted date and time. Finally, we append this paragraph element to the body of the HTML document.

Many people confuse about JavaScript array[] and object{}, so this tutorial will explain the difference in between JavaScript {} and []. Arrays are ordered collections of values while Objects are collections of key-value pairs.

You can define the basic structure of an HTML document as below. It includes a title and sets up the document’s body.