Learn more with dummies

Enter your email to join our mailing list for FREE content right to your inbox. Easy!

Basic I/O Commands in JavaScript

By Andy Harris

Part of JavaScript & AJAX For Dummies Cheat Sheet

JavaScript programmers commonly use the commands shown in the following table for controlling dialog-based input and output in programs to be used on the Web.

Element Description
alert("message"); Creates a popup dialog containing "message."
stringVar = prompt("message") Send message to user in a dialog box, retrieve text input from user and store it in stringVar.