27 lines
646 B
Markdown
27 lines
646 B
Markdown
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||
|
|
||
|
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [countOf](./js-utils.countof.md)
|
||
|
|
||
|
## countOf() function
|
||
|
|
||
|
Calculate the "length" of an array or value.
|
||
|
|
||
|
Arrays return their length, single values return 1, and nil values return 0. This counts the number of elements that setOrPush would add.
|
||
|
|
||
|
<b>Signature:</b>
|
||
|
|
||
|
```typescript
|
||
|
export declare function countOf(val: unknown): number;
|
||
|
```
|
||
|
|
||
|
## Parameters
|
||
|
|
||
|
| Parameter | Type | Description |
|
||
|
| --- | --- | --- |
|
||
|
| val | <code>unknown</code> | |
|
||
|
|
||
|
<b>Returns:</b>
|
||
|
|
||
|
`number`
|
||
|
|