Bird
0
0

What will be logged to the console?

medium📝 Predict Output Q4 of 15
Angular - RxJS Operators
What will be logged to the console?
import { of } from 'rxjs';
import { map, filter } from 'rxjs/operators';

of(1, 2, 3, 4).pipe(
  filter(x => x % 2 === 0),
  map(x => x * 10)
).subscribe(console.log);
A1, 2, 3, 4
B20, 40
C2, 4
D10, 30
Step-by-Step Solution
Solution:
  1. Step 1: Apply filter operator

    Filter keeps only even numbers: 2 and 4.
  2. Step 2: Apply map operator

    Map multiplies each by 10: 20 and 40.
  3. Final Answer:

    20, 40 -> Option B
  4. Quick Check:

    filter then map output = 20, 40 [OK]
Quick Trick: Operators run in order inside pipe [OK]
Common Mistakes:
MISTAKES
  • Ignoring filter and mapping all values
  • Mixing order of operators
  • Expecting original values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes