发表于: sitebuild | 作者: | 日期: 2008/11/28 12:11

1、
数字(number)是最基本的数据类型,在JavaScript中,数字不区分整型数值和浮点型数值,所有的数字都是由浮点型组成。JavaScript使用标准的8字节IEEE浮点数值格式表示数值。

2、
当数值过大时,JavaScript会自动将数值转换为科学计数法格式显示。

示例:

alert(10000000000000000000000000);

显示为:
2009-11-05_172829.png

可以直接在IE地址栏中输入:

javascript:alert(10000000000000000000000000);

挺方便的吧,:-D

3
Math对象包含了一组用来处理数值的函数。
示例:

alert(Math.abs(-1));

输出为1。
详细介绍参阅:http://www.w3school.com.cn/js/jsref_obj_math.asp

4
将数字型变量转换为字符串型使用如下方法:

alert(typeof(”+1));

输出:
2009-11-05_173325.png

: https://blog.darkmi.com/2008/11/28/589.html

本文相关评论 - 1条评论都没有呢
Post a comment now » 本文目前不可评论

No comments yet.

Sorry, the comment form is closed at this time.