What Is A Function in javascript | Anonymous Functions

7/12/2021
All Articles

#Function_in_javascript #javascript #function #Anonymous #Functions #documentreadyjavascript

What Is A Function in javascript  | Anonymous Functions

What Is A Function in javascript ?

A Javascript function is a collection of statements either named or unnamed that can be called from elsewhere in a JavaScript program.
A function will be executed by an event or an explicit call to the function.
Functions can be defined in both <head> and <body> section but generally are placed in the head section.

Example :   

document ready javascript

 

          
           
function <function name>(var 1,var 2. . .)
 { 
// some code return (variable or value);
 }

 

 


Anonymous Functions

 

A function definition can be directly assigned to a variable .
This variable is like any other variable except that it’s value is a function definition and can be used as a reference to a function.

Syntax:

 

 

 var variablename = function(Argument List)
 {  
//Function Body  

}; 

 

 

Article