You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// dummy() // Executes since dummy is stored while memory creation phase
2
+
// dummy2() // TypeError b is no a function
3
+
// * Function statement aka Function Declaration
4
+
functiondummy(){
5
+
console.log('dummy called')
6
+
}
7
+
8
+
// * Function expression
9
+
vardummy2=function(){
10
+
console.log('dummy 2 called')
11
+
return'dummy2'
12
+
}
13
+
14
+
// * Anonymous Function
15
+
/**
16
+
function(){
17
+
18
+
}
19
+
*/
20
+
21
+
// * Named function expression
22
+
constdummy3=functionnewDummy(){
23
+
console.log('newDummy called')
24
+
}
25
+
26
+
dummy3()
27
+
// newDummy() // ReferenceError: newDummy is not defined
28
+
29
+
// Difference Parameters and Arguments
30
+
constdummy4=function({ parameter1, parameter2 }){
31
+
console.log({ parameter1, parameter2 })
32
+
}
33
+
34
+
dummy4({parameter1: 'argument 1',parameter2: 'argument 2'})// the values which are being passed
35
+
36
+
// * First class functions in JS
37
+
// * The ability to use functions as values, and can be passed as arguments to another functions and can be returned from the functions this ability is known as first class functions
0 commit comments