voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
22 lines (12 loc) • 767 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/database](./database.md) > [DataSnapshot](./database.datasnapshot.md) > [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`<!-- -->).