Automatic conversion to a string
Explains how nonstrings are automatically converted to strings.
When a function or a method that expects a string as
one of its arguments is passed a nonstring value, this value is automatically
converted to a string. For example, if the string method indexOf is
passed a number as its first argument, this number is treated like
its string representation:
"The 10 commandments".indexOf(10) ->
4
Similarly, operators that take string operands automatically convert nonstring operands to strings:
"The " + 10 + " commandments" ->
"The 10 commandments"
The conversion to a string uses the toString method
of the given value. All built-in values have a toString method.