Avoiding Single Operators
Let’s take a look at why we should avoid using a single operator.
We'll cover the following
In the last lesson, we used two operators: one for retrieving the value from the input and another for parsing it as an integer. If we wanted to, we could have put everything into a single operator, as shown here:
map(event => parseInt(event.target.value)
However, this is not recommended because we won’t be able to swap operators if we ever need to. If we do, we’ll have to change the entire chain. Let’s look at an example.
The pluck
operator
Let’s update our code to the following:
Get hands-on with 1400+ tech skills courses.