get largest number in array javascript
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3
get largest number in array javascript
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3
Find Largest Number by function by javascript
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us