---
title: "Discussion on \"What is an observable\" | Hashnode"
description: "Discussion on \"What is an observable\". An Observable is basically a function that can return a stream of values either synchronously or asynchronously to an observer over time. The consumer can get the value by calling subscribe() method. Let's look at a simple example of an Observable\nim..."
url: "https://hashnode.com/posts/what-is-an-observable/5f798be29c3b6e41012170cf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What is an observable](https://lymcode.hashnode.dev/what-is-an-observable?utm_source=hashnode&utm_medium=feed)

An Observable is basically a function that can return a stream of values either synchronously or asynchronously to an observer over time. The consumer can get the value by calling subscribe() method. Let's look at a simple example of an Observable im...

Oct 4, 2020 · 1 min read · lymcode.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#angularjs](https://hashnode.com/tag/angularjs)

## Written by

[Lymcode](https://hashnode.com/@RoshanKrSoni)

@RoshanKrSoni · Ranchi, Jharkhand

  
[View profile](https://hashnode.com/@RoshanKrSoni)

Web Developer

Passionate Software developer

## Responses 1

Markdown supported · ⌘↵ to post

[Purvi Barot](https://hashnode.com/@purvi)

[Oct 5, 2020](https://hashnode.com/posts/what-is-an-observable/5f798be29c3b6e41012170cf/comment/5f7acbd19c3b6e410121802a)

Observables are also like callbacks and promises - that are responsible for handling async requests. Observables are a part of the RXJS library.

```
import { Observable } from 'rxjs';

const observable = new Observable(subscriber => {
  subscriber.next(1);
  subscriber.next(2);
  subscriber.next(3);
  setTimeout(() => {
    subscriber.next(4);
    subscriber.complete();
  }, 1000);
});
```

**Observable Phases**

-   Creation
-   Subscription.
-   Execution
-   Destruction.

[Lymcode](https://hashnode.com/@RoshanKrSoni)

[Oct 5, 2020](https://hashnode.com/posts/what-is-an-observable/5f798be29c3b6e41012170cf/comment/5f7acbd19c3b6e410121802a#reply-5f7b1f1b9d088e603ef3902e)

Thank you. can we publish it here ?
