Advertisement
BoGeo

input

Nov 11th, 2019
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. const getGets = (arr) => {
  2. let index = 0;
  3.  
  4. return () => {
  5. const toReturn = arr[index];
  6. index += 1;
  7. return toReturn;
  8. };
  9. };
  10.  
  11. const test = [
  12.  
  13. '3',
  14. '2',
  15. '5',
  16. '1'
  17. ];
  18.  
  19.  
  20. const gets = this.gets || getGets(test);
  21. const print = this.print || console.log;
  22.  
  23.  
  24. let input = gets();
  25. let string = '';
  26. let arr;
  27.  
  28. string += input;
  29.  
  30. arr = string.split(' ', string.length);
  31.  
  32.  
  33. for (i = 0; i < arr.length; i++) {
  34. print(arr[i]);
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement