[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [defaultWhen](./js-utils.defaultwhen.md)
## defaultWhen() function
Return the first element when `condition` is true and the second element when `condition` is false.
Signature:
```typescript
export declare function defaultWhen(condition: boolean, ...items: Array): TVal;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| condition | boolean | |
| items | Array<TVal> | |
Returns:
TVal