You might think how base conversion worked out in JavaScript. Here the solution, Number to Base Value Number.toString([radix]); Number - Integer number that is to be converted radix - base value either 2, 8, 16 (optional parameter) Example: <script> //INTEGER TO BASE VALUE var n = 42; document.write(n.toString(2)); document.write(n.toString(8)); document.write(n.toString(16)); //HEX TO base var h = 0xa; document.write(n.toString(2)); document.write(n.toString(8)); </script> Output: 101010 52 2a 1010 12 Any Base value to In tege r value parseInt(string, [radix]); string - string that is to be converted. The string can be binary value, octal value or hexadecimal value radix - base value either 2, 8, 16 (optional parameter) Example: <script> //Binary to integer document.write(parseInt('111',2)); //Octal to integer document.write(parseInt('12',8)); //Hex to integer document.write(parseInt('0xc',16)); </sc...
Javascript tips and tricks, JQuery tips & tricks, JQuery Plugins, CSS Tricks and Tips, things you may not know about javascript, AngularJS tips and tricks, Laravel, PHP tips and tricks, computer programming, grapical user interface using c, c header files, computer graphics lab program, 2d translation, 3d translation, line drawing algorithm, circle drawing algorithm, DDA, Midpoint, 3D projection using c, Personal diary, Mini project using c, Graphical User Interface using C