20 lines
444 B
JavaScript
20 lines
444 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;
|
|
// }
|
|
|
|
return Math.max(a, b, c);
|
|
}
|
|
|
|
console.log(findMaximum(1, 2, 3)); // => 3
|
|
console.log(findMaximum(102, 59, 18)); // => 102
|
|
console.log(findMaximum(532, 532, 345)); // => 532
|
|
|
|
// Übung 12: findMaximum Fehler
|
|
// Die Kommentare zeigen das erwartete Ergebnis.
|