Function- is just a bunch of codes that you can reuse easily over and over again.
Basic Function
<script type="text/javascript">
function greeting ( )
{
alert ("How are you?);
}
greeting ( )
< /script >
Parameters in Functions
< script type="text/javascript">
function addition (a,b)
{
ans=a+b;
return ans;
}
alert( addition (3, 5));
alert( addition (30, 55)); // you can use it multiple time
< /script>