DEV Community

yash kumat
yash kumat

Posted on

1 1

3 JS Interactions

1. alert

shows a message.

alert("Hello");

"JavaScript alert"

2. prompt

shows a message asking the user to input text or null.

var name = prompt("What is your name?");

"JavaScript prompt"

Note: You can add an optional second parameter, the initial value for the input field.

var name = prompt("What is your name?", "John");

"JavaScript prompt with default value"

3. confirm

shows a message and waits for the user to press "OK" or "Cancel". It returns "true" for OK and "false" for Cancel.

var confirmation = confirm("Are you sure?");

"JavaScript confirm"

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay