摘要: Math对象中有3个方法用于处理小数值的舍入操作,它们是:Math.ceil()、Math.floor()、Math.round()。Math.ceil():向上舍入为最接近的整数。Math.floor():向下舍入为最接近的整数。Math.round():标准的四舍五入。alert(Math.ceil(3.2)); // 4alert(Math.ceil(3.5)); // 4alert(Math.ceil(3.6)); // 4alert(Math.floor(3.2)); // 3alert(Math.floor(3.5)); // 3alert(Math.floor(3... 阅读全文
posted @ 2013-03-20 23:08 白色的海 阅读(1399) 评论(0) 推荐(0) 编辑
摘要: 在javascript中有两种函数的定义法:函数声明,函数表达式。 函数声明: 函数表达式: 函数声明和函数表达式在执行效果上是等价的,但是解析器在向执行环境中加载数据对函数声明和函数表达式的处理确实不同的。 1.对于函数声明 在代码开始执行之前,解析器通过函数声明提升(function decla 阅读全文
posted @ 2013-03-20 16:10 白色的海 阅读(476) 评论(4) 推荐(0) 编辑