Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created April 23, 2020 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/08b2a1f37a4e20c3fa1a3029b542cd60 to your computer and use it in GitHub Desktop.
Save NyaGarcia/08b2a1f37a4e20c3fa1a3029b542cd60 to your computer and use it in GitHub Desktop.
Subscribing to Observables created with from()
letter$.subscribe(letter => console.log(letter));
// Output: "R","x","J","S"," ","i","s"," ","c","o","o","l"
fruit$.subscribe(console.log);
// Output: "Strawberry", "Cherry", "Blackberry"
pokemon$.subscribe(console.log);
// Output: ["Squirtle", "Water"], ["Charmander", "Fire"], ["Bulbasur", "Grass"]
promise$.subscribe(promise => console.log(promise));
// Output "I promise to start learning RxJS"
node$.subscribe(node => console.log(node));
// Output: HTMLParagraphElement {tagName: "p", attributes: {...}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment