About 67 results
Open links in new tab
  1. javascript - How to iterate a Map () object? - Stack Overflow

    Oct 27, 2023 · Similarly, if you want the entries in the map (I notice you use Object.entries at one point), use entries or the default iterator. Note that in a few places in your code, you seem to …

  2. javascript - Using map () on an iterator - Stack Overflow

    May 10, 2017 · Say we have a Map: let m = new Map();, using m.values() returns a map iterator. But I can't use forEach() or map() on that iterator and implementing a while loop on that …

  3. Transforming a Javascript iterable into an array

    An iterator doesn't have a key but a Map does have key value pairs. Hence, in my humble opinion, it doesn't make any sense to define general map and filter functions for iterators.

  4. javascript - How to make an iterator out of an ES6 class - Stack …

    Feb 26, 2015 · Making an object iterable means this object has a method named with the Symbol.iterator. When this method gets called, it should return an interface called iterator. This …

  5. How to loop the JavaScript iterator that comes from generator?

    Dec 17, 2015 · A self-contained, single-line alternative to the while loop in the question is the for loop. And for the special case of iterating through for pure side effect or depletion, rather than …

  6. How to iterate (keys, values) in JavaScript? - Stack Overflow

    ECMAScript 2015 solution above threw "TypeScript and Iterator: Type 'IterableIterator<T>' is not an array type" but plain ol myMap().foreach() worked well. – ttugates Commented Apr 10, …

  7. JavaScript Iterator Class - Stack Overflow

    Feb 10, 2016 · in Javascript, an iterator is useful if one needs to iterate through all the elements of an array, but in an asynchronous fashion (loop through the first n elements, then resume after …

  8. In JavaScript ES6, what is the difference between an iterable and …

    Dec 23, 2019 · iterator - any object that has next function to return the next value; iterable - any object that has [Symbol.iterator] function that returns an iterator; But when you have an object …

  9. Adding a custom iterator to a javascript class - Stack Overflow

    The iterable object is iterable because it has a function [Symbol.iterator]() that returns an 'iterator object'. The iterator object is an iterator because it has a next() function. In this case the …

  10. Loop through an array in JavaScript - Stack Overflow

    Jun 10, 2010 · As long as your JavaScript implementation is compliant with the previous edition of the ECMAScript specification (which rules out, for example, versions of Internet Explorer …