{}
CODE VISUALIZER
Learn DSA the way it should be — with step-by-step code visualization.
Try now!
CODE VISUALIZER
Learn DSA with step-by-step code visualization.
Try now!
run-icon
main.js
function* naturals() { for (let n = 1; true; yield n++) {} } const naturalsGen = naturals(); const result = naturalsGen .drop(3) // dropメソッド .take(5) // takeメソッド .map(n => n * 2 + 1) // mapメソッド .toArray(); // toArrayメソッド console.log(result); // [9, 11, 13, 15, 17]
Output