-
-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy path6-matrix.js
More file actions
32 lines (28 loc) · 645 Bytes
/
6-matrix.js
File metadata and controls
32 lines (28 loc) · 645 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
'use strict';
const max = matrix => {
let value = matrix[0][0];
for (const index in matrix) {
const line = matrix[index];
for (const index2 in line) {
const colum = line[index2];
if (colum > value) value = colum;
}
}
return value;
};
/*const max = matrix => {
let value = matrix[0][0];
for (const arr of matrix) {
for (const i of arr) {
if (i > value) value = i;
}
}
return value;
};*/
/*const max = matrix => {
const modeMatrix = matrix
.map(arr => arr.reduce((a, b) => (a > b ? a : b)))
.reduce((a, b) => (a > b ? a : b));
return modeMatrix;
};*/
module.exports = { max };