-
Notifications
You must be signed in to change notification settings - Fork 0
/
oo.js
72 lines (54 loc) · 879 Bytes
/
oo.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
'use strict';
var a = 123;
let b = 0.5;
const c = 'alma';
if (true) {
var kacsa = 5;
}
function add(a, b) {
return a + b;
}
console.log(add(0, 1));
console.log(add(0));
console.log(add());
console.log(add(0, 1, 2, 3, 4));
function Car(km) {
this.km = km;
}
Car.prototype = {
ride(km) {
this.km += km;
}
};
let car = new Car(5);
car.ride(5);
console.log(car);
class Car2 {
constructor(km) {
this.alma = 5;
this.km += km;
}
ride = (km) => {
this.km += km;
}
}
console.log(Car2.prototype.ride)
const createCar = (km, engine) => {
let name = 'volvo';
const ride = (kms) => {
km += kms;
};
const getName = () => name;
return {
ride,
getName,
alma,
check: engine.check,
}
};
let car = createCar(5);
car.ride(5);
console.log(Car2.alma)
[1,2,3,4,5,6,7,8]
.filter(e => e % 2 === 0)
.some(e => e > 6)