Created
June 1, 2020 05:02
-
-
Save gfx/5dae841a13d98c0aee6fbdf7b528eccd to your computer and use it in GitHub Desktop.
Revisions
-
gfx created this gist
Jun 1, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ function* iterateParams() { for (const x of ["a", "b", "c"]) { for (const i of [1, 2, 3]) { yield { x, i }; } } } for (const p of iterateParams()) { console.log(p); } // results: // { x: 'a', i: 1 } // { x: 'a', i: 2 } // { x: 'a', i: 3 } // { x: 'b', i: 1 } // { x: 'b', i: 2 } // { x: 'b', i: 3 } // { x: 'c', i: 1 } // { x: 'c', i: 2 } // { x: 'c', i: 3 }