O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The skip() operator

The skip() operator returns an Observable which bypasses a given number of elements from the beginning and propagates the others until the completion of the Observable. It has the following signature:

observable.skip(count); 

The only parameter is mandatory:

  • count: This is the number of elements to bypass

In the following example, we will use the skip() operator to bypass the first element in the Observable:

Rx.Observable     .of(1,2,3)     .skip(1)     .subscribe((i)=>console.log(i)); 

If you run this code, it will print the following:

    2    3

This operation is illustrated in the following diagram:

This operator can be used ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required