This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
// 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;
|
||||
}
|
||||
// if (a >= b && a >= c) {
|
||||
// return a;
|
||||
// } else if (b >= a && b >= c) {
|
||||
// return b;
|
||||
// } else {
|
||||
// return c;
|
||||
// }
|
||||
|
||||
return Math.max(a, b, c);
|
||||
}
|
||||
|
||||
console.log(findMaximum(1, 2, 3)); // => 3
|
||||
|
||||
Reference in New Issue
Block a user