JS Built-ins
StringStringbeginner

String() β€” convert number to string

πŸ“– Usage Example
String(42)         // β†’ '42'
String(true)       // β†’ 'true'
String(null)       // β†’ 'null'
String(undefined)  // β†’ 'undefined'

Use String() to safely convert any value to its string representation.

String Constructor

String(value) converts any value to its string representation without new.

Challenge: Implement numToString(n) that uses String(n) to convert a number to a string.

numToString(42)   // β†’ '42'
numToString(3.14) // β†’ '3.14'
πŸ’‘ Hints (2)
  • β€’ `String(value)` is the function form β€” no `new` keyword needed.
  • β€’ It calls the internal `ToString` abstract operation on the value.