Skip to content

Commit 1eba53d

Browse files
committed
Ders 02
1 parent 3a87e98 commit 1eba53d

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

ders02.js

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// FONKSIYONLAR
2+
3+
//**** */ Function Declarion // Statement
4+
5+
/* function square(num) { // Parametre
6+
return (num * num);
7+
}
8+
9+
square(5) // Arguman */
10+
11+
/* square(5);
12+
console.log(square(5)); */
13+
14+
// console.log(square(3)); () ---> Invoke
15+
16+
// Function declaration --> HOISTED
17+
18+
19+
//**** */ Function Expression
20+
21+
/* const square = function (num) {
22+
return (num * num);
23+
} */
24+
25+
// Func name is optional
26+
/*
27+
console.log(square);
28+
console.log(square(5)); */
29+
30+
// FIRST - CLASS FUNCTIONS
31+
32+
/* const myArr = [6, "Arin", function() {console.log("Array Element");} ]
33+
34+
myArr[2]();
35+
36+
const myObj = {
37+
age: 5,
38+
name: "Arin",
39+
func: function() { console.log("Object Element"); }
40+
};
41+
42+
myObj.func();
43+
44+
console.log(20 + (function() {return 10; })() ) // IIFE */
45+
46+
/* console.log(square);
47+
square(5); */
48+
49+
/* const square = function (num) {
50+
return (num * num);
51+
} */
52+
53+
// Function Expression is not HOISTED
54+
// Function Expression can be anonymous
55+
56+
// FIRST - CLASS FUNCTIONS DEVAM
57+
58+
/* const addFive = function(num, func) {
59+
console.log(num + func());
60+
}
61+
62+
addFive(10, function() { return 5;}) */
63+
64+
/* const myFunc = function (num) {
65+
return function toDouble() {
66+
console.log(num * 2);
67+
}
68+
} */
69+
70+
/* myFunc(7)(); */
71+
72+
/* const result = myFunc(7);
73+
74+
result(); */
75+
76+
// IIFE
77+
// Immediately Invocable Function Expression
78+
79+
/* (function() {
80+
console.log(5 + 12);
81+
})(); */
82+
83+
// console.log(sum);
84+
85+
/* sum();
86+
console.log(sum); */
87+
88+
function square(num1, num2) {
89+
return (num1 * num2);
90+
}
91+
92+
console.log(square.length);

0 commit comments

Comments
 (0)