Define a function : Function Definition « Function « JavaScript Tutorial






<html>
<head>
<title>Function Demo</title>

<script language="javascript" type="text/javascript">
<!--

function greetVisitor()
{
     var myName = prompt("Name.", "");
     alert("Welcome " + myName + "!")
}

//-->
</script>

</head>
<body>

<h1>Function Demo</h1>

</body>
</html>








7.1.Function Definition
7.1.1.Functions
7.1.2.Define the simplest function
7.1.3.Define a function
7.1.4.Calculation in function
7.1.5.Recursive function