crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Iterables</h2> <p>Home Made Iterable:</p> <p id="demo"></p> <script> // Home Made Iterable function myNumbers() { let n = 0; return { next: function() { n += 10; return {value:n, done:false}; } }; } // Create Iterable const n = myNumbers(); n.next(); // 10 n.next(); // 20 n.next(); // 30 document.getElementById("demo").innerHTML = n.next().value; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KPGgyPkphdmFTY3JpcHQgSXRlcmFibGVzPC9oMj4NCjxwPkhvbWUgTWFkZSBJdGVyYWJsZTo8L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQovLyBIb21lIE1hZGUgSXRlcmFibGUNCmZ1bmN0aW9uIG15TnVtYmVycygpIHsNCiAgbGV0IG4gPSAwOw0KICByZXR1cm4gew0KICAgIG5leHQ6IGZ1bmN0aW9uKCkgew0KICAgICAgbiArPSAxMDsNCiAgICAgIHJldHVybiB7dmFsdWU6biwgZG9uZTpmYWxzZX07DQogICAgfQ0KICB9Ow0KfQ0KDQovLyBDcmVhdGUgSXRlcmFibGUNCmNvbnN0IG4gPSBteU51bWJlcnMoKTsNCm4ubmV4dCgpOyAvLyAxMA0Kbi5uZXh0KCk7IC8vIDIwDQpuLm5leHQoKTsgLy8gMzANCg0KZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPSBuLm5leHQoKS52YWx1ZTsNCjwvc2NyaXB0Pg0KPC9ib2R5Pg0KPC9odG1sPg==