
> hexlet-pairs@1.0.6 documentation /Users/mokevnin/hexlet/js-pairs
> documentation "build" "src/index.js" "-f" "md"

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [isPair][1]
-   [cons][2]
-   [car][3]
-   [cdr][4]
-   [toString][5]

## isPair

Check if something is pair

**Parameters**

-   `pair` **Pair?** 

**Examples**

```javascript
const pair = cons(5, 'hello');
isPair(pair); // true
isPair(5); // false
```

Returns **[boolean][6]** 

## cons

Build pair

**Parameters**

-   `a` **any** 
-   `b` **any** 

**Examples**

```javascript
const pair = cons(5, 'hello');
```

```javascript
const pair = cons(cons(1, null), 'world');
```

Returns **Pair** 

## car

Get car (first element) from pair

**Parameters**

-   `pair` **Pair** 

**Examples**

```javascript
const pair = cons(5, 'hello');
car(pair); // 5
```

Returns **any** 

## cdr

Get cdr (second element) from pair

**Parameters**

-   `pair` **Pair** 

**Examples**

```javascript
const pair = cons(5, 'hello');
cdr(pair); // hello
```

Returns **any** 

## toString

Convert pair to string (recursively)

**Parameters**

-   `pair` **Pair** 

**Examples**

```javascript
toString(cons('', 10)); // ('', 10)
```

Returns **[string][7]** 

[1]: #ispair

[2]: #cons

[3]: #car

[4]: #cdr

[5]: #tostring

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
