<script type="text/javascript"> var num = 3; alert(typeof num); num = 3 + ''; //simplest to just add a blank string on to the number alert(typeof num); </script>
Hi! For converting numbers to binary, octal, or hexadecimal strings (or to any other base) you can use, in JavaScript 1.1, the standard method Number.toString(radix) for converting a number to a string representing that number in a non-decimal number system (e.g. to a string of binary, octal or hexadecimal digits) Wish you succees.