Document.write: It directly o/p's the value on the displayed page.
Syntax: document.write (" your message " );
e.g document.write (" Hi Friends " );
Var : Used to declare a variable.
Syntax: Var variablename="any value";
e.g Var x="20";
Prompt: Used to i/p data from the user.
Syntax: prompt ("message", "initial value (if recquired)");
e.g. prompt (" Please enter your name: ", " ");
Alert: It pops up a dialog box with (OK) option.
Syntax: alert ("your message ");
e.g : alert("welcome to world of javascript");
e.g : alert("welcome to world \n of javascript");
Confirm: Gives a dialog box with (OK) and (CANCEL) options.
Syntax: confirm ("your question ");
e.g. confirm ("Would you like to learn Javascript ? ");
Example1.
<html>
<head>
<script>
document.write ("Welcome to Javascript World");
var name="ACPatil";
prompt (" Please Enter Your Name ", "xyz");
alert ("Welcome to "+name+" ");
confirm ("Would you like to learn javascript");
</script>
</head>
</html>