The toString() method is used for converting variable into string.

  var num = 15;
  var a = num.toString();
  var b = num.toString(2);
  var c = num.toString(8);
  var d = num.toString(16);

The Results are as Below

 15
 1111
 17
 f 

Leave a reply