- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12_function_expression.js
More file actions
Latest commit
24 lines (20 loc) · 586 Bytes
/
Copy path12_function_expression.js
File metadata and controls
24 lines (20 loc) · 586 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// function expressions use variable for declare
// and without name after write function or called
// anonymous function
// example here function basics
functionadd(num1,num2){
returnnum1*num2;
}
// function expression
// remember name add already exist please dont same
constaddExpressions=function(num1,num2){
returnnum1*num2;
};
// function ES6
constaddES6=(num1,num2)=>num1*num2;
// print them
constnum1=add(10,10);
constnum2=add(20,10);
// access use array
constsum=[num1,num2,addExpressions(10,30),addES6(20,20)];
console.log(sum);