Complete the code to filter the list to only include items with status 'active'.
const activeItems = items.[1](item => item.status === 'active');
The filter operator selects items that meet a condition. Here, it keeps only items with status 'active'.
Complete the Angular template code to display only users whose age is greater than 18 using the filter pipe.
<div *ngFor="let user of users | [1]: user => user.age > 18">{{user.name}}</div>
The filter pipe selects array elements that satisfy the condition. Here, it shows users older than 18.
Fix the error in the RxJS observable pipeline to filter values greater than 10.
import { of } from 'rxjs'; import { [1] } from 'rxjs/operators'; of(5, 15, 8, 20).pipe( [1](value => value > 10) ).subscribe(console.log);
The filter operator in RxJS selects emitted values that pass the test. Here, it keeps values greater than 10.
Fill both blanks to create a filtered list of products with price less than 100 and map to their names.
const cheapProductNames = products.[1](p => p.price < 100).[2](p => p.name);
First, filter selects products cheaper than 100. Then, map extracts their names.
Fill all three blanks to create objects mapping user names to ages for users older than 21.
const userAges = users .[1](user => user.age > 21) .[2](user => ({[[3]]: user.age}));
First, filter selects users older than 21. Then, map creates objects with user names as keys and ages as values.