diff --git a/aio/content/guide/comparing-observables.md b/aio/content/guide/comparing-observables.md index 87cfb69073..049d16308a 100644 --- a/aio/content/guide/comparing-observables.md +++ b/aio/content/guide/comparing-observables.md @@ -46,7 +46,7 @@ promise.then((value) => { * Observables differentiate between transformation function such as a map and subscription. Only subscription activates the subscriber function to start computing the values. -observable.map((v) => 2*v); +observable.pipe(map((v) => 2*v)); * Promises do not differentiate between the last `.then` clauses (equivalent to subscription) and intermediate `.then` clauses (equivalent to map). @@ -112,7 +112,7 @@ The following code snippets illustrate how the same kind of operation is defined Transform -
obs.map((value) => value * 2 );
+
obs.pipe(map((value) => value * 2));
promise.then((value) => value * 2);
@@ -227,7 +227,7 @@ An observable produces values over time. An array is created as a static set of
concat()
-
obs.concat(obsB)
+
concat(obs, obsB)
➞1➞2➞3➞5➞7➞'a'➞'b'➞'c'
@@ -238,7 +238,7 @@ An observable produces values over time. An array is created as a static set of
filter()
-
obs.filter((v) => v>3)
+
obs.pipe(filter((v) => v>3))
➞5➞7
@@ -249,7 +249,7 @@ An observable produces values over time. An array is created as a static set of
find()
-
obs.find((v) => v>3)
+
obs.pipe(find((v) => v>3))
➞5
@@ -260,7 +260,7 @@ An observable produces values over time. An array is created as a static set of
findIndex()
-
obs.findIndex((v) => v>3)
+
obs.pipe(findIndex((v) => v>3))
➞3
@@ -271,9 +271,9 @@ An observable produces values over time. An array is created as a static set of
forEach()
-
obs.forEach((v) => {
+      
obs.pipe(tap((v) => {
   console.log(v);
-})
+}))
 1
 2
 3
@@ -294,7 +294,7 @@ An observable produces values over time. An array is created as a static set of
   
     
map()
-
obs.map((v) => -v)
+
obs.pipe(map((v) => -v))
➞-1➞-2➞-3➞-5➞-7
@@ -305,8 +305,8 @@ An observable produces values over time. An array is created as a static set of
reduce()
-
obs.scan((s,v)=> s+v, 0)
-
➞1➞3➞6➞11➞18
+
obs.pipe(reduce((s,v)=> s+v, 0))
+
➞18
arr.reduce((s,v) => s+v, 0)