class Car constructor teg color speed this teg teg this color color th

 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
class Car {
constructor(teg = '', color = '', speed = 0) {
this.teg = teg;
this.color = color;
this.speed = speed;
}
getSpeed(array) {
let tempArr = [];
for (const key in array) {
tempArr.push(array[key].speed);
}
for (const key in tempArr) {
if (tempArr[key] === Math.max(...tempArr)) {
console.log(array[key]);
return
}
}
}
}
const arrayCar = [
{
name: 'BMW',
speed: 20,
color: 'red'
},
{
name: 'Shkoda',
speed: 10,
color: 'green'
},
{
name: 'Dodge',
speed: 50,
color: 'blue'
},
{
name: 'Maz',
speed: 60,
color: 'black'
}
];
let chekNums = new Car().getSpeed(arrayCar);