How to call Function in Javascript  

Functions are the central working units of JAVASCRIPT. Almost all the scripting code uses one or more function to get the desired result. It eliminates the need of writing the same code again and again.

0 357 Technology | Javascript
Wed Dec 26 , 2018

If you want your page to provide certain user-defined functionality, then functions are a convenient way of doing so.
Therefore it is important that you understand what a function is and how it works.


function fn_name(arguments)


You can pass arguments to a function. These are variables, either numbers or strings, which are used inside the function.

Calling the Function

You can call the function from any other places in your Javascript code. After the function is executed the control goes bact to the other script that called it.


<script language="Javascript">
function add(num1,num2)
 alert("Addition of two numbers: "+ (num1+num2));
<h1>Add two numbers</h1>
<input type="button" value="add (5,5)" onClick="add(5,5)" style="background:#f9af30">


Subscribe & Get Regular Updates On Your E-mail