Statements EX1

JavaScript Output Example
Let




In the code above, we have added a button with the text Display Message and an onclick event that triggers the displayMessage() function when clicked.

The displayMessage() function declares a variable message with the value Hello, World! and then uses window.alert to output the message to the browser.

When you click the Display Message button, it will call the displayMessage() function, and the message Hello, World! will be logged to the browser console.

Feel free to customize the styles and modify the code as per your requirements.

Comments

Popular posts from this blog