Advertisement
Timkor

nMax

Dec 28th, 2020
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let n;
  2. let max;
  3. while (n != 0) {
  4.     n = prompt("Введіть число");
  5.     if (n % 2 == 0) { //код не заходить в цю, умову не розумію чому
  6.         console.log('заходить до if (n % 2 == 0)');
  7.         console.log(`n > max: ${n} > ${max} === ${n > max}`);
  8.         if (n > max) {
  9.             console.log('заходить до  if (n > max)')
  10.             max = n
  11.         }
  12.     }
  13. }
  14. console.log("Найбільше число з тих що були введені це "  +  n);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement