Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function maxNumber(input) {
- let index = 0;
- let command = input[index];
- index++;
- let maxNum = Number.MIN_SAFE_INTEGER;
- while (command !== "Stop") {
- let currentNumber = Number(command);
- command = input[index];
- index++;
- if (currentNumber > maxNum) {
- maxNum = currentNumber;
- }
- }
- console.log(`${maxNum}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment