toString Method

Top  Previous  Next

Converts a number to a string in a standard format.

Syntax

number.toString([base])

Arguments

numberAn integer that is a date/time value.
baseAn integer representing the base or radix you would like the number to be displayed as.

Return Value

A string representation of the given number.If the base is 16, the toString() method returns the hexadecimal representation of the given number, otherwise it returns the decimal representation of the number.

Examples

var num=255;

Net.write(num.toString(16));   // Returns ff