The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/database > DataSnapshot > val

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).

Signature:

val(): any;

Returns:

any

The DataSnapshot's contents as a JavaScript value (Object, Array, string, number, boolean, or null).