15 lines
307 B
JavaScript
15 lines
307 B
JavaScript
// logical error
|
|
function findMaximum(a, b, c) {
|
|
if (a > b && a > c) {
|
|
return a;
|
|
} else if (b > a && b > c) {
|
|
return b;
|
|
} else {
|
|
return c;
|
|
}
|
|
}
|
|
|
|
console.log(findMaximum(1, 2, 3)); // => 3
|
|
console.log(findMaximum(102, 59, 18)); // => 102
|
|
console.log(findMaximum(532, 532, 345)); // => 532
|