Number toString()
toString() method optionally accepts a single argument indicating the radix:
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var num = 10;
document.writeln(num.toString()); //"10"
document.writeln(num.toString(2)); //"1010"
document.writeln(num.toString(8)); //"12"
document.writeln(num.toString(10)); //"10"
document.writeln(num.toString(16)); //"a"
</script>
</head>
<body>
</body>
</html>
The following code is using the Number.toString method to do the conversion.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script type="text/javascript">
var myData1 = (5).toString() + String(5);
document.writeln("Result: " + myData1);
</script>
</body>
</html>