Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Use String(value) for a clear general-purpose conversion, value.toString(radix) when you need a particular number base, or a template literal such as `${value}` to insert the number into surrounding text. These are JavaScript runtime operations, so they work the same way in TypeScript.
Choose the conversion that fits
| Use | Example | Best fit |
|---|---|---|
String(value) |
String(count) |
Explicit, general-purpose conversion to text. |
value.toString(radix) |
count.toString(16) |
Converting a number by itself, especially when you need a non-decimal base. |
| Template literal | `${count}` |
Embedding a number in a larger string. |
For example:
const count: number = 42;
const asString: string = String(count); // "42"
const alsoString: string = count.toString(); // "42"
const message: string = `Count: ${count}`; // "Count: 42"
const hex: string = count.toString(16); // "2a"
Convert to a different number base
toString() without an argument uses decimal. Pass an integer radix from 2 through 36 to represent the number in another base: for example, value.toString(2) for binary or value.toString(16) for hexadecimal. Passing a radix outside that range, or one that is not an integer, throws a RangeError. See the Number.prototype.toString() reference.
For negative numbers, the minus sign is preserved in other radixes. The resulting binary text is not a two’s-complement representation; it is the number’s sign and magnitude expressed using the requested base.
Know what the resulting text represents
Decimal notation can be exponential
When converting in base 10, JavaScript can use scientific notation for numbers with a magnitude of at least 1021 or below 10-6. If your output must follow a particular display convention, verify the resulting representation rather than assuming every value will appear as ordinary decimal digits.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
Special numeric values have text forms
Both 0 and -0 convert to "0". NaN, Infinity, and -Infinity convert to their corresponding text forms.
Converting does not recover lost integer precision
A JavaScript Number cannot exactly represent every integer. If a large integer was rounded when it became a Number, converting it to a string gives text for that rounded value—not the original digits. For example, distinct large integer literals can compare equal after Number representation, as noted in the Number conversion reference.
Rank #2
- TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
- TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
- Lightweight, Classic fit, Double-needle sleeve and bottom hem
When exact integer digits beyond the safe range matter, use BigInt where appropriate and avoid passing the value through Number. The BigInt reference describes the separate integer type.
Text conversion is not display formatting
String(value), toString(), and template interpolation convert the numeric value to text; they do not, by themselves, provide currency symbols, grouped digits, or locale-specific decimal separators. Treat those as formatting requirements rather than basic conversion, and choose a formatting API suited to the output you need.
Recommended Free Tools
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




