JavaScript > Introduction

Show Alert in JavaScript

How to show an alert to the user in JavaScript?


In case we want to alert the user with some information, alert method/function can be used.

<script>
      alert("I am alert.");
</script>

Above code snippet shall give “I am alert” alert to the user as displayed in the picture below.

Output

If you want alert messages to display in multiple line, you can separate the messages with “\n”.

 Views: 5076 | Post Order: 4



Write for us






Hosting Recommendations