StartsWith

Copied!
( value, search )

Description

The StartsWith function returns true when the value string starts with the search string, or false when it does not.

Parameters

Argument Type Definition and Requirements

value

The string to compare.

search

The string to search for at the start of value.

Returns

Returns a boolean: true when value starts with search, or false when it does not.

Examples

The following query demonstrates the case where the value string starts with the search string:

Copied!
client.query(
  q.('Fauna', 'F')
)
.then((ret) => console.log(ret))
true

The following query demonstrates the case where the value string does not start with the search string:

Copied!
client.query(
  q.('Fauna', 'f')
)
.then((ret) => console.log(ret))
false

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!