You can pass arguments to a function. These are variables, either strings or numbers, which are utilized inside the function. Certainly the output of the function based on the arguments you give it.
In the following instance we pass two arguments, the number 1 & the string 'house':
example(1,'house');
While these arguments arrive at the function, they are stored up in two variables, a & b. You ought to declare these in the function header, as you can look below.
function example(a,b)
<HTML>
<HEAD>
<TITLE>IGNOU </TITLE>
<SCRIPT Language = "JavaScript">
function example(a, b)
{
var number;
number += a ;
alert('You have chosen: ' + b);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="selectForm">
<P><B>Click the button below:</B>
<BR>
<P><INPUT TYPE="button" VALUE="Click" onClick="example(1,'house')">
</FORM>
</BODY>
</HTML>
Figure: Using Functions
This adds one to number and displays "You have decided: house". Certainly, if you call the function like example (5,'palace'), then it adds five to number & displays "You have decided: palace". The output of the function based on the arguments you give it.