<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/database](./database.md) &gt; [DataSnapshot](./database.datasnapshot.md) &gt; [val](./database.datasnapshot.val.md)

## DataSnapshot.val() method

Extracts a JavaScript value from a `DataSnapshot`<!-- -->.

Depending on the data in a `DataSnapshot`<!-- -->, the `val()` method may return a scalar type (string, number, or boolean), an array, or an object. It may also return null, indicating that the `DataSnapshot` is empty (contains no data).

<b>Signature:</b>

```typescript
val(): any;
```
<b>Returns:</b>

any

The DataSnapshot's contents as a JavaScript value (Object, Array, string, number, boolean, or `null`<!-- -->).

