# of

#### signature: `of(...values, scheduler: Scheduler): Observable`

## Emit variable amount of values in a sequence and then emits a complete notification.

### Examples

**Example 1: Emitting a sequence of numbers**

( [StackBlitz](https://stackblitz.com/edit/typescript-kbpvmm?file=index.ts\&devtoolsheight=100) | [jsBin](http://jsbin.com/kodixitoji/1/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/f7b35ayz/) )

```js
// RxJS v6+
import { of } from 'rxjs';
//emits any number of provided values in sequence
const source = of(1, 2, 3, 4, 5);
//output: 1,2,3,4,5
const subscribe = source.subscribe(val => console.log(val));
```

**Example 2: Emitting an object, array, and function**

( [StackBlitz](https://stackblitz.com/edit/typescript-m1jbw9?file=index.ts\&devtoolsheight=100) | [jsBin](http://jsbin.com/xevobujama/1/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/d9rng4dj/) )

```js
// RxJS v6+
import { of } from 'rxjs';
//emits values of any type
const source = of({ name: 'Brian' }, [1, 2, 3], function hello() {
  return 'Hello';
});
//output: {name: 'Brian'}, [1,2,3], function hello() { return 'Hello' }
const subscribe = source.subscribe(val => console.log(val));
```

### Related Recipes

* [Battleship Game](/learn-rxjs/recipes/battleship-game.md)
* [Breakout Game](/learn-rxjs/recipes/breakout-game.md)
* [Car Racing Game](/learn-rxjs/recipes/car-racing-game.md)
* [Mine Sweeper Game](/learn-rxjs/recipes/mine-sweeper-game.md)
* [Platform Jumper Game](/learn-rxjs/recipes/platform-jumper-game.md)
* [Save Indicator](/learn-rxjs/recipes/save-indicator.md)
* [Swipe To Refresh](/learn-rxjs/recipes/swipe-to-refresh.md)
* [Tetris Game](/learn-rxjs/recipes/tetris-game.md)
* [Type Ahead](/learn-rxjs/recipes/type-ahead.md)

### Additional Resources

* [of](https://rxjs.dev/api/index/function/of) 📰 - Official docs
* [Creation operators: of](https://egghead.io/lessons/rxjs-creation-operator-of?course=rxjs-beyond-the-basics-creating-observables-from-scratch) 🎥 💵 - André Staltz

***

> 📁 Source Code: <https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/of.ts>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.learnrxjs.io/learn-rxjs/operators/creation/of.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
