ProdanTenev

Smaller Number

Mar 1st, 2022
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.38 KB | None | 0 0
  1. function smallerNumber(input) {
  2.     index = 0;
  3.     command = input[index];
  4.     index++;
  5.     let minNum = Number.MAX_SAFE_INTEGER;
  6.     while (command !== "Stop") {
  7.         let currentNumber = Number(command);
  8.         if (minNum > currentNumber) {
  9.             minNum = currentNumber;
  10.         }
  11.         command = input[index];
  12.         index++;
  13.     }
  14.     console.log(minNum);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment