> For the complete documentation index, see [llms.txt](https://racoon-js.gitbook.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://racoon-js.gitbook.io/en/api/array.md).

# array

array(\[schema])

## Effect

Get a schema object of type array.

## Arguments

* `[schema]` ***(schema)*** - The schema object to restrict the type of array's elements. If it's not a type of schema or it's not given, it will be ignored, which means elements of the array can be any type.

## Example

```javascript
const schema1 = racoon.array();
schema1.validate(1); // fail
schema1.validate({}); // fail
schema1.validate([1, 'a', {}]); // pass

const schema2 = racoon.array(
  racoon.number()
);
schema2.validate(['a', 'b']); // fail
schema2.validate([1, 2]); // pass
```
