Skip to content

Instantly share code, notes, and snippets.

@cesarkohl
Created January 13, 2020 14:35
Show Gist options
  • Select an option

  • Save cesarkohl/f6f17d2bfbedbde7551928e5b66ec22f to your computer and use it in GitHub Desktop.

Select an option

Save cesarkohl/f6f17d2bfbedbde7551928e5b66ec22f to your computer and use it in GitHub Desktop.
var iterator = witches [Symbol.iterator] ();
var done = false;
var next = iterator.next ();
of {
 var wizard = next.value;
 hatSelectorMakeHouseSelection (wizard);
 next = iterator.next ();
} while (! next.done);
Assuming that the doSelectionDomain method displays on the console the student's name and their home, using our list of wizards from the previous example in this algorithm, we have as output:
student: Harry Potter | House: Gryffindor
student: Hermione Granger | House: Gryffindor
student: Ron Weasley | House: Gryffindor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment