Home > @firebase/database > DataSnapshot > hasChildren
DataSnapshot.hasChildren() method
Returns whether or not the DataSnapshot
has any non-null
child properties.
You can use hasChildren()
to determine if a DataSnapshot
has any children. If it does, you can enumerate them using forEach()
. If it doesn't, then either this snapshot contains a primitive value (which can be retrieved with val()
) or it is empty (in which case, val()
will return null
).
Signature:
hasChildren(): boolean;
Returns:
boolean
true if this snapshot has any children; else false.