toString()

Get the string representation of the value.

Signature

toString(): String

Description

The toString() method returns the String representation of the calling object. If the calling object is a String, it returns the original string, and the original string isn’t changed.

Parameters

None

Return value

Type Description

String

Copy of the original string.

Examples

Confirm that the calling string type returns itself:

'foobar'.toString()
"foobar"

Get the String representation of a Time() value:

let t1 = Time.fromString("2022-10-20T21:15:09.890729Z")
t1.toString()
"2022-10-20T21:15:09.890729Z"

Get the String representation of a floating point number:

1.5.toString()
"1.5"

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!