This commit is contained in:
14
06_js-debug/uebungen/u12_find-maximum-error/index.js
Normal file
14
06_js-debug/uebungen/u12_find-maximum-error/index.js
Normal file
@@ -0,0 +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;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(findMaximum(1, 2, 3)); // => 3
|
||||
console.log(findMaximum(102, 59, 18)); // => 102
|
||||
console.log(findMaximum(532, 532, 345)); // => 532
|
||||
Reference in New Issue
Block a user