Obtenga el mayor número en Array JavaScript
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3
Jerky
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3
const max = arr => Math.max(...arr);
function largestNumber(first, second, third) {
if (first > second && first > third) {
return first;
} else if (second > first && second > third) {
return second;
} else {
return third;
}
}
const num1 = 100;
const num2 = 120;
const num3 = 80;
console.log(largestNumber(num1, num2, num3));
//Output: 120