JS取整 1.toFixed(num)(ps:num为保留小数点后几位) 自定义保留小数点后几位,进行四舍五入.严格来说,这个函数不属于取整,但是当num=0时,也就是取整了,所以一起放到这里,方便查找. 栗子: var num = 5.2369; num .toFixed(0) = 5; num .toFixed(1) = 5.2; num .toFixed(2) = 5.24; num .toFixed(3) = 5.237; 2.Math.ceil(num) //返回大于等于其数值参数的最…
那几个函数的应用: <script> //全局变量删不掉,而全局属性能删掉 var a=123; function aa () { b=321; delete b; } aa(); delete a; //console.log(a); var str="wo ai sanmei"; /*构造函数模式*/ function strobj (argument) { this.concats=function (argument) { arguments[0].concat(a…
canrun <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">…