So far, we've used filter
to prevent values when a condition is met. Sometimes you want two different behaviors based on a condition which is where you would naturally reach for an if
and an else
. Let's take a look at what an ifElse
operator would look like in the context of our live search box.