Skip to content

Instantly share code, notes, and snippets.

@rosd89
Created September 7, 2018 05:32
Show Gist options
  • Save rosd89/c949d5533b40b16e8512b5a89d631c8d to your computer and use it in GitHub Desktop.
Save rosd89/c949d5533b40b16e8512b5a89d631c8d to your computer and use it in GitHub Desktop.
const generator = function*(i, j){
for(let ii = 1; ii <= i; ii++) {
for(let jj = 1; jj <= j; jj++) {
yield [ii, jj, ii * jj];
}
}
};
for(const [i, j, k] of generator(9,9)){
console.log(`${i} x ${j} = ${k}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment