What does this program print?

from Iterators and generators
Node 24 intermediate 2 min

What does this program print?

JavaScript
function* sequence() {
  const amount = yield 'ready';
  return amount * 2;
}

const iterator = sequence();
const results = [iterator.next(10), iterator.next(7)];
console.log(JSON.stringify(results));
Open in playground
Report an error