# Destiny Operator

**URL:** <https://es.discourse.group/t/destiny-operator/895>\
**Category:** 💡 Ideas\
**Created:** [July 28, 2021, 2:07pm UTC](https://es.discourse.group/t/destiny-operator/895 "2021-07-28T14:07:59Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![ethanlal04](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ethanlal04/32/918_2.png) [@ethanlal04](https://es.discourse.group/u/ethanlal04)\
**Post date:** [July 29, 2021, 5:00am UTC](https://es.discourse.group/t/destiny-operator/895/7 "2021-07-29T05:00:06Z")

</div>

> [@ethanlal04](#):
>
> In the above above code, `isElgible` is bound to `age > 18`. Instead of storing a boolean, it keeps an expression in memory. Whenever we modify `age` and log `isEligible`, it should call the stored expression and return the result.

My bad, I got the wording wrong. What I meant to say is... well take an example:

```javascript
const todos = [
  { title: "Water the plants", done: false },
  { title: "Buy milk", done: true }
];

const todosToDo = () => todos.filter((todo) => !todo.done);

```

Here every time we call `todosToDo` for something like logging, it recalculates all the todos that are not done. This impacts the performance. Instead, we can bind `todosToDo` to `todos` so that it is only updated when `todos` is changed.

```javascript
const todosToDo <= todos.filter((todo) => !todo.done);

```

It doesn't have to be `<=`. It could be anything even a keyword.

We could take this to function level...

```javascript
<= console.log(`Todos changed ${todosToDo}`);

```

Above, `console.log` is called whenever `todosToDo` is changed. This could be powerful for debugging.

Hope I have explained it enough. Thank you 😅.

---

_[View the full topic](https://es.discourse.group/t/destiny-operator/895)._
