challenge-algorithms-v2.0/03-maxValue/index.js

15 lines
184 B
JavaScript

export function maxValue(values) {
if (values.length === 0) {
return 0;
}
else {
let maxNumber = values.reduce((a, b) => Math.max(a, b))
return maxNumber;
}
}