RxJS Crash Course – Map Operator

0

Now we’re going to look at a whole bunch of rxjs operators and starting with map. Map allows you to transform the emitted value based on some underlying logic.
In this case we created an observable of some numbers and we’re going to transform them to their logarithm.

So, when we subscribe instead of getting the actual numbers we get the log of that number.

A more practical example for app developers is when you send an API request that responds in JSON you need to convert the JSON string to JavaScript.

So, what you can do is use the map operator to run json.parse on that string from the API. Then the observable will you met JavaScript objects that you can actually use in your app.

Next we learn do operator in next article.

0