Advertisement
Liliana797979

max number

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