-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.ts
More file actions
35 lines (31 loc) · 776 Bytes
/
functions.ts
File metadata and controls
35 lines (31 loc) · 776 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
25
26
27
28
29
30
31
32
33
34
35
function topla(x, y) {
return x + y
}
function topla2(x: number, y: number): number {
return x + y
}
topla("ab", "ab")
topla2(2, 2)
let topla3 = function (x: number, y: number): number {
return x + y
}
console.log(topla(2, 4))
console.log(topla("Ankara", 4))
console.log(topla2(2, 4))
console.log(topla3(4, 8))
function topla4(x: number, y: number = 0): number {
return x + y
}
console.log(topla4(3, 3))
function topla5(x: number, y?: number): number {
if (y) {
return x + y
}
return x
}
console.log(topla5(3))
function davetEt(ilkDaveltli: string, ...digerleri: string[]) {
return ilkDaveltli + digerleri.join(" ")
}
console.log(davetEt("Engin", "Derin", "Salih", "Ahmet"))
console.log(davetEt("Engin", "Derin", "Salih", "Ahmet"))