-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.js
More file actions
67 lines (50 loc) · 1.64 KB
/
Functions.js
File metadata and controls
67 lines (50 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// a(); prints a called
// x(); x is not a function; TypeError
//----------------------------------------------------------
// Function Statements aka Function Declarations
// function a() {
// console.log('a called');
// }
//----------------------------------------------------------
//Function Expression
// var x = function () {
// console.log('x called');
// };
//----------------------------------------------------------
// a();
// x();
//----------------------------------------------------------
//Anonymous Functions : Does not have their own identity
// and they are used where function are used as values that
// means they are used to assign a variable;
//----------------------------------------------------------
//Named function Expression
// var y = function xyz() {
// console.log(xyz);
// //xyz is a local variable
// };
// y();
// xyz(); xyz is not defined; ReferenceError
//----------------------------------------------------------
// function add(p, q, r) {
// //p,q,r are parameters
// console.log(p + q + r);
// }
// add(60, 5, 4); //60,5,4 are arguments
//----------------------------------------------------------
//the ability to use functions as values is called first
// class function and can be passed as arguments, can be
// returned as function from other function
// var func = function abc(param1) {
// return function def() {
// console.log('function is called');
// };
// };
// console.log(func());
//----------------------------------------------------------
//Arrow function
// var b = function () {
// console.log('b called');
// };
// b();
//----------------------------------------------------------