TZinovieva

Min Number

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