Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Last active April 23, 2020 18:53
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/cb2b4ccb196da66c4021376373bc1c9e to your computer and use it in GitHub Desktop.
Save NyaGarcia/cb2b4ccb196da66c4021376373bc1c9e to your computer and use it in GitHub Desktop.
Comparation of Observables created with from() and of()
const fruitsOf$ = of(["Strawberry", "Cherry"], ["Lemon", "Orange"]);
const fruitsFrom$ = from(["Strawberry", "Cherry", "Blackberry"]);
fruitOf$.subscribe(fruit => console.log(fruit));
// Output: ["Strawberry", "Cherry"] ["Lemon", "Cherry"]
fruitFrom$.subscribe(console.log);
// Output: "Strawberry", "Cherry", "Blackberry"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment