Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created April 23, 2020 15:07
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/0f9ad96869f4a574aae87bd60c56ce4f to your computer and use it in GitHub Desktop.
Save NyaGarcia/0f9ad96869f4a574aae87bd60c56ce4f to your computer and use it in GitHub Desktop.
Subscribing to Observables created with of()
number$.subscribe(number => console.log(number));
// Output: 1 2 3 4 5
pokemon$.subscribe(pokemon => console.log(pokemon));
// Output: Squirtle Charmander Bulbasur
fruit$.subscribe(fruit => console.log(fruit));
// Output: ["Strawberry", "Cherry"] ["Lemon", "Cherry"]
iceCream$.subscribe(iceCream => console.log(iceCream));
// Output: { size: "Large", toppings: ["Oreos", "Chocolate syrup"] } { size: "small", toppings: ["Strawberries"] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment