Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Binary, Octal, Hexadecimal, Exponential Numbers</h1> <p id="p1">Binary = </p> <p id="p2">Ocatal = </p> <p id="p3">Hexadecimal = </p> <p id="p4">Exponential = </p> <script> var binry = 0b100100; // binary var oct = 0o544; // octal var hex = 0x123456789ABCDEF; // hexadecimal var exp = 256e-5; // exponential document.getElementById("p1").textContent += binry; document.getElementById("p2").textContent += oct; document.getElementById("p3").textContent += hex; document.getElementById("p4").textContent += exp; </script> </body> </html>
Result: