-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathders02.js
92 lines (60 loc) · 1.47 KB
/
ders02.js
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// FONKSIYONLAR
//**** */ Function Declarion // Statement
/* function square(num) { // Parametre
return (num * num);
}
square(5) // Arguman */
/* square(5);
console.log(square(5)); */
// console.log(square(3)); () ---> Invoke
// Function declaration --> HOISTED
//**** */ Function Expression
/* const square = function (num) {
return (num * num);
} */
// Func name is optional
/*
console.log(square);
console.log(square(5)); */
// FIRST - CLASS FUNCTIONS
/* const myArr = [6, "Arin", function() {console.log("Array Element");} ]
myArr[2]();
const myObj = {
age: 5,
name: "Arin",
func: function() { console.log("Object Element"); }
};
myObj.func();
console.log(20 + (function() {return 10; })() ) // IIFE */
/* console.log(square);
square(5); */
/* const square = function (num) {
return (num * num);
} */
// Function Expression is not HOISTED
// Function Expression can be anonymous
// FIRST - CLASS FUNCTIONS DEVAM
/* const addFive = function(num, func) {
console.log(num + func());
}
addFive(10, function() { return 5;}) */
/* const myFunc = function (num) {
return function toDouble() {
console.log(num * 2);
}
} */
/* myFunc(7)(); */
/* const result = myFunc(7);
result(); */
// IIFE
// Immediately Invocable Function Expression
/* (function() {
console.log(5 + 12);
})(); */
// console.log(sum);
/* sum();
console.log(sum); */
function square(num1, num2) {
return (num1 * num2);
}
console.log(square.length);