[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [getOrDefault](./js-utils.getordefault.md)
## getOrDefault() function
Get a map key or default value when the key does not exist or is nil.
Signature:
```typescript
export declare function getOrDefault(map: Map, key: TKey, defaultValue: TVal): TVal;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| map | Map<TKey, TVal>
| |
| key | TKey
| |
| defaultValue | TVal
| |
Returns:
`TVal`