Advertisement
Spocoman

01. Read Text

Dec 26th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function readText(input) {
  2.     let counter = 0;
  3.     while (input[counter] !== "Stop"){
  4.         console.log(input[counter]);
  5.         counter++;
  6.     }
  7. }
  8.  
  9.  
  10. Друго решение с фор цикъл:
  11.  
  12. function readText(input) {
  13.     for (let i = 0; i <= Number.MAX_VALUE; i++) {
  14.         if (input[i] === "Stop") {
  15.             break;
  16.         }
  17.         console.log(input[i]);
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement