TZinovieva

Min Number

Jun 9th, 2022
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function minNumber(input) {
  2.         index = 0;
  3.         let command = input[index];
  4.         index++;
  5.         let minNum = Number.MAX_SAFE_INTEGER;
  6.    
  7.         while (command !== "Stop") {
  8.             let currentNum = Number(command);
  9.    
  10.             if (currentNum < minNum) {
  11.                 minNum = currentNum;
  12.             }
  13.             command = input[index];
  14.             index++;
  15.         }
  16.         console.log(minNum);
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment