Sunday, February 20, 2011

JavaScript toString () method

One very nice feature toString() method from JavaScript has is the ability to get the binary representation of a number in just one line of code

var a = 5;

This will output:


You can give toString() a parameter which is the radix in which to output the number.

Of course you can use 8 to get octal version or 16 to get the hexa version of the number.

Very powerful and also very simple

1 comment:

  1. In 2004 and 2006, Koellerer was banned for six months outcome of} his bad conduct. In addition, in August 2010, he facilitated betting by inserting odds 솔 카지노 for matches and had links for putting bets. A 1906 betting scandal between the Massillon Tigers and Canton Bulldogs, two of the highest groups in professional American soccer in the early 1900s, led to the demise of "big-money" professional soccer for a number of} years.