factory method in JavaScript

```
const behavior1 = () => {
  console.log('behavior1');
};

const behavior2 = () => {
  console.log('behavior2');
};

const factory = (condition) => {
  if (condition) return behavior1; 
  return behavior2;
}

factory(1>0)();
```