When I input three numbers 100, 50, and 20 through the prompt, why does print 50 as the largest number? and how can I solve it?

Viewed 29

let num1 = parseFloat(prompt('Enter first number: '));
let num2 = parseFloat(prompt('Enter second number: '));
let num3 = parseFloat(prompt('Enter third number: '));

if (num1 > num2 && num1 > num3) {
  document.write('your f number is: ' + num1);
  console.log(num1);
} else if (num2 > num1 && num2 > num3) {
  document.write('your s number is: ' + num2);
  console.log(num2);
} else {
  document.write('your t number is: ' + num3);
  console.log(num3);
}

I have tried various ways but no.

0 Answers
Related