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

8 lines
326 B
JavaScript
Raw Normal View History

export function maxValue(values) {
2022-10-31 23:18:50 +00:00
return Math.max(...values)
}
console.log(maxValue([4, 6, 12, 5])); // 12
console.log(maxValue([9, 234, 312, 999, 21, 2311])); // 2311
console.log(maxValue([533, 234, 23423, 32, 432])); // 23423
console.log(maxValue([5, 4, 3, 2, 1])); // 5
console.log(maxValue([-1, -5, -10, -45])); // -1