使用布尔值,而不要使用Boolean对象
true和false,而不是new Boolean(…)
new Boolean(false) && true == true(?)
Microsoft AJAX Library中提供的唯一扩展
parse静态方法
Boolean.parse("true") // 返回true
Boolean.parse("fAlSe") // 返回false
32位整数或64位浮点数(IEEE 754)
整数表示法
var num = 50; // 10进制表示法
var num = 060; // 48,8进制表示法
var num = 0xFF; // 255,16进制表示法
浮点数表示法
var num = 5.0;
var num = 3.2e9; // 3.2*10^9,科学计数法
浮点数的范围
MAX_VALUE
MIN_VALUE
极值
POSITIVE_INFINITY
NEGATIVE_INFINITY
Not an Number
NaN
<div id="info"></div>
<script language="javascript" type="text/javascript">
function display(text)
{
document.getElementById("info").innerHTML += (text + "<br />");
}
display("Max Value = " + Number.MAX_VALUE);
display("Min Value = " + Number.MIN_VALUE);
display("--------------");
display("Positive Infinity = " + Number.POSITIVE_INFINITY);
display("Negative Infinity = " + Number.NEGATIVE_INFINITY);
display("1 / 0 = " + (1 / 0))
display("Max Value * 10 = " + (Number.MAX_VALUE * 10));
display("Max Value + 10 = " + (Number.MAX_VALUE + 10));
display("Infinity / 10 = " + (Number.POSITIVE_INFINITY / 10));
display("--------------");
display("NaN = " + Number.NaN);
display("parseInt('ABC') = " + parseInt('ABC'));
display("3 - 'ABC' = " + (3 - "ABC"));
display("(NaN == NaN) = " + (NaN == NaN));
display("(NaN != NaN) = " + (NaN != NaN));
display("isNaN(NaN) = " + isNaN(NaN));
</script>
<script language="javascript" type="text/javascript">
function display(text)
{
document.getElementById("info").innerHTML += (text + "<br />");
}
display("Max Value = " + Number.MAX_VALUE);
display("Min Value = " + Number.MIN_VALUE);
display("--------------");
display("Positive Infinity = " + Number.POSITIVE_INFINITY);
display("Negative Infinity = " + Number.NEGATIVE_INFINITY);
display("1 / 0 = " + (1 / 0))
display("Max Value * 10 = " + (Number.MAX_VALUE * 10));
display("Max Value + 10 = " + (Number.MAX_VALUE + 10));
display("Infinity / 10 = " + (Number.POSITIVE_INFINITY / 10));
display("--------------");
display("NaN = " + Number.NaN);
display("parseInt('ABC') = " + parseInt('ABC'));
display("3 - 'ABC' = " + (3 - "ABC"));
display("(NaN == NaN) = " + (NaN == NaN));
display("(NaN != NaN) = " + (NaN != NaN));
display("isNaN(NaN) = " + isNaN(NaN));
</script>