Advertisement
kstoyanov

String Iterator

Jul 16th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(args) {
  2.   const arrStr = args.split(' ');
  3.   const strMap = new Map();
  4.  
  5.   arrStr.forEach((el, index) => {
  6.     strMap.set(index, el);
  7.   });
  8.  
  9.   const mapIter = strMap.values();
  10.   let result = mapIter.next();
  11.  
  12.   while (!result.done) {
  13.     console.log(result.value);
  14.     result = mapIter.next();
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement