Skip to content

Instantly share code, notes, and snippets.

@edubskiy
Last active July 12, 2020 11:52
Show Gist options
  • Save edubskiy/eb0611d0911e031422a4d250541569fc to your computer and use it in GitHub Desktop.
Save edubskiy/eb0611d0911e031422a4d250541569fc to your computer and use it in GitHub Desktop.
Try to guess a word at max 4 times, otherwise you lost
import 'dart:html';
// <h4>Guess the word</h4>
// <input />
// <button>Click me</button>
void main() {
final ButtonElement button = querySelector('button');
final InputElement input = querySelector('input');
button.onClick
.take(4)
.where((event) => input.value == 'banana')
.listen(
(event) => print("You got it!"),
onDone: () => print('Nope, bad guess')
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment