Converts a Number
or String
to a single-character String
.
char()
converts numbers to their single-character string representations.
The parameter, n
, is the value to convert. If a number is passed, as in char(65)
, the corresponding single-character string is returned. If a string is passed, as in char('65')
, the string is converted to an integer (whole number) and the corresponding single-character string is returned. If an array is passed, as in char([65, 66, 67])
, an array of single-character strings is returned.
See MDN for more information about conversions.
Examples
Syntax
char(n)
char(ns)
Parameters
n
String|Number:
value to convert.
ns
Array:
values to convert.
Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/conversion.js and open a pull request!