Bird
0
0

Consider the following Angular RxJS code:

medium📝 Predict Output Q4 of 15
Angular - RxJS Operators
Consider the following Angular RxJS code:
import { of } from 'rxjs';
import { map, filter } from 'rxjs/operators';

of(2, 3, 5, 8).pipe(
  filter(num => num > 3),
  map(num => num + 1)
).subscribe(console.log);

What will be the output?
A6, 9
B3, 5, 9
C4, 6, 9
D5, 6, 9
Step-by-Step Solution
Solution:
  1. Step 1: Apply filter

    Filter keeps numbers greater than 3: 5 and 8.
  2. Step 2: Apply map

    Map adds 1 to each: 5 + 1 = 6, 8 + 1 = 9.
  3. Step 3: Output

    The output is 6 and 9.
  4. Final Answer:

    6, 9 -> Option A
  5. Quick Check:

    Filter then map transforms stream correctly [OK]
Quick Trick: Filter first, then map to transform values [OK]
Common Mistakes:
MISTAKES
  • Applying map before filter
  • Including numbers not passing filter
  • Misunderstanding operator order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes