Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created May 15, 2019 17:46
Show Gist options
  • Save luisenriquecorona/0c0c4578aeb3845a63bfd87e432ab779 to your computer and use it in GitHub Desktop.
Save luisenriquecorona/0c0c4578aeb3845a63bfd87e432ab779 to your computer and use it in GitHub Desktop.
Code for Understanding done Property
//get generator instance variable
let generatorSequenceResult =
generatorSequence();
console.log('done value for the first time',
generatorSequenceResult.next())
console.log('done value for the second time',
generatorSequenceResult.next())
console.log('done value for the third time',
generatorSequenceResult.next())
//Running this code will print the following:
done value for the first time { value: 'first', done: false }
done value for the second time { value: 'second', done: false }
done value for the third time { value: 'third', done: false }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment