Javascript
Function assignment can be done in two ways:-
1. Named Function assignment
2. Anonymous function assignment
Hoisting***
Process of moving Function Declaration to the top of file.
Done automatically by Js Engine
Function sum (a,b){
Return a+b; For only 2 input parameters not for 1 and 0 parameters
} here, arguments will create an object not an array
Function sum(a,b){
Let total =0;
for(let value of arguments) For any no. of input parameters
Total= total value;
Return total;
}
Rest Operator:- Denoted by (…)
Function sum(…args){
[Link](args);
rest parameter should be last parameter and it is in array
Sum(1,2,3,4,5,6);
Default Parameter:-