**** Anonymous Functions ****
- The Function without name called as Anonymous Function.
- Anonymous Functions also called as Arrow Functions in TypeScript.
- Anonymous Functions are more secured compared to named functions.
- Anonymous Functions utilizes the heap memory efficiently.
Syntax.
//function definition
var var_name = (argumants with data type):return_type =>{
//Biusiness Logic
}
//call the anonymous function
var_name();
Ex_1:
create the anonymous function with following variable
@fun_one
anonymous function return "Welcome...!" message
call the anonymous function.
Ex_2:
create the anonymous function with 3 arguments.
name of variable - @fun_one
@arg1 - string
@arg2 - string
@arg3 - string
call the anonymous function with 3 arguments.
Ex_3:
one arrow function return another arraow function.
inner arraow function return "Welcome...!" message
Ex_4:
create arrow function with 3 arguments.
while calling the arrow function ,
"pass the definitions of anonymous functions"
as arguments.
Ex_5:
push 5 anonymous functions to empty array.
Ex_6:
create the nested arrow functions with number manipulations
- The Function without name called as Anonymous Function.
- Anonymous Functions also called as Arrow Functions in TypeScript.
- Anonymous Functions are more secured compared to named functions.
- Anonymous Functions utilizes the heap memory efficiently.
Syntax.
//function definition
var var_name = (argumants with data type):return_type =>{
//Biusiness Logic
}
//call the anonymous function
var_name();
Ex_1:
create the anonymous function with following variable
@fun_one
anonymous function return "Welcome...!" message
call the anonymous function.
Ex_2:
create the anonymous function with 3 arguments.
name of variable - @fun_one
@arg1 - string
@arg2 - string
@arg3 - string
call the anonymous function with 3 arguments.
Ex_3:
one arrow function return another arraow function.
inner arraow function return "Welcome...!" message
Ex_4:
create arrow function with 3 arguments.
while calling the arrow function ,
"pass the definitions of anonymous functions"
as arguments.
Ex_5:
push 5 anonymous functions to empty array.
Ex_6:
create the nested arrow functions with number manipulations
No comments:
Post a Comment