TOP - JavaScript - 数値の書式

数値を記述する方法には以下の種類があります。
整数         : 100
浮動小数点数 : 100.123
               1.00123E+2
16進数       : 0x64
8進数        : 0144

(例)
<SCRIPT type="text/javascript">
<!--
    function btnclick()
    {
        var n1 = 100;
        var n2 = 100.123;
        var n3 = 1.00123E+2;
        var n4 = 0x64;
        var n5 = 0144;
        var s  =     "n1(100) = " + n1 + "\n";
        var s  = s + "n2(100.123) = " + n2 + "\n";
        var s  = s + "n3(1.00123E+2) = " + n3 + "\n";
        var s  = s + "n4(0x64) = " + n4 + "\n";
        var s  = s + "n5(0144) = " + n5 + "\n";
        alert(s);
    }
//-->
</SCRIPT>


Copyright(C) 2006-2011 CLAYPOT. All Rights Reserved.