-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
75 lines (65 loc) · 1.52 KB
/
test.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
var x;
var y;
var z;
z = 5;
z = 'ceva';
var PersonJob;
(function (PersonJob) {
PersonJob[PersonJob["TEACHER"] = 0] = "TEACHER";
PersonJob[PersonJob["ENGINEER"] = 1] = "ENGINEER";
PersonJob[PersonJob["POLICEMAN"] = 2] = "POLICEMAN";
})(PersonJob || (PersonJob = {}));
/*let o: IPerson;
o = {
name: 'nume',
surname: 'surname',
job: PersonJob.TEACHER
};
console.log(o.name, o.surname);
let array: string[] = [];
array.push('ceva');
array.push('ceva2');
array.push('ceva3');
array.forEach(element => console.log(element));
let people: IPerson[] = [];
people.push({ name: 'Rus', surname: 'Vlad', job: PersonJob.ENGINEER });
people.push({ name: 'Valean', surname: 'Vlad', job: PersonJob.POLICEMAN });
people.forEach(element => console.log(element.name, element.surname, element.job));
let a: number | string;
a = 'a';
a = 5;
let b: string | 1;
b = 'xulescu';
//b = 2;
let v: string | null;*/
function functie() {
console.log('altceva');
}
function add(a, b) {
return a + b;
}
function comparePeople(p1, p2) {
return (p1.name === p2.name) && (p1.surname === p2.surname) && (p1.job === p2.job);
}
var p1 = {
name: 'Andrei',
surname: 'Popescu',
job: PersonJob.TEACHER
};
var p2 = {
name: 'Andrei',
surname: 'Popescu',
job: PersonJob.TEACHER
};
console.log(comparePeople(p1, p2));
console.log(p1 === p2);
functie();
console.log(add(4, 3));
function handler(x, y, func) {
var result = x + y;
func(result);
}
function specialLog(num) {
console.log(num + 5);
}
handler(1, 2, specialLog);