BACK
PracticeInterview: throttleTime() rapid clicks
PRACTICE · 36 · 練

Interview: throttleTime() rapid clicks

From three synchronous clicks, let through only the first.

  1. Solve the task in the editor — no long theory.
  2. Run the check and compare your output with the expected result.
  3. Stuck? Open the solution and carry the approach into your own code.
Solution spoiler · click to reveal
const { of, throttleTime } = Rx;

const result$ = of('click-1', 'click-2', 'click-3').pipe(
  throttleTime(100)
);

result$.subscribe(value => console.log(value));
script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...