- TypeScript Tutorial
- TypeScript - Home
- TypeScript - Overview
- TypeScript - Environment Setup
- TypeScript - Basic Syntax
- TypeScript - Types
- TypeScript - Variables
- TypeScript - Operators
- TypeScript - Decision Making
- TypeScript - Loops
- TypeScript - Functions
- TypeScript - Numbers
- TypeScript - Strings
- TypeScript - Arrays
- TypeScript - Tuples
- TypeScript - Union
- TypeScript - Interfaces
- TypeScript - Classes
- TypeScript - Objects
- TypeScript - Namespaces
- TypeScript - Modules
- TypeScript - Ambients
- TypeScript Useful Resources
- TypeScript - Quick Guide
- TypeScript - Useful Resources
- TypeScript - Discussion
TypeScript - Number toString()
This method returns a string representing the specified object. The toString() method parses its first argument, and attempts to return a string representation in the specified radix (base).
Syntax
number.toString( [radix] )
Parameter Details
radix − An integer between 2 and 36 specifying the base to use for representing numeric values.
Return Value
Returns a string representing the specified Number object.
Example
var num = new Number(10); console.log(num.toString()); console.log(num.toString(2)); console.log(num.toString(8));
On compiling, it will generate the same code in JavaScript.
The code will produce the following output −
10 1010 12
typescript_numbers.htm
Advertisements
To Continue Learning Please Login
Login with Google