Advertisement
Liliana797979

viarno reshenie max number

Feb 10th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function maxNumber(input) {
  2.     let index = 0;
  3.     let command = input[index];
  4.     index++;
  5.     let maxNum = Number.MIN_SAFE_INTEGER;
  6.  
  7.     while (command  != "Stop") {
  8.         let num = Number(command);
  9.         if (num > maxNum) {
  10.             maxNum = num;
  11.         }
  12.         command = input[index];
  13.         index++;
  14.     }
  15.     console.log(maxNum);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement