math
烂漫花海
只有十分努力,才能看起来毫不费力
展开
-
Math.round(),Math.ceil(),Math.floor()的区别
Math.round(),Math.ceil(),Math.floor()的区别1.Math.round():根据“round”的字面意思“附近、周围”,可以猜测该函数是求一个附近的整数,看下面几个例子就明白。四舍五入小数点后第一位<5正数:Math.round(11.46)=11负数:Math.round(-11.46)=-11 小数点后第一位>5正数:Math.round(11.6...转载 2018-02-23 14:20:59 · 174 阅读 · 0 评论 -
IP地址的正则表达式校验
IP 地址的正则表达式 var IP = "^((25[0-5]|2[0-4]\\d|[1]{1}\\d{1}\\d{1}|[1-9]{1}\\d{1}|\\d{1})($|(?!\\.$)\\.)){4}$"; 创建正则表达式的类 var patt1=new RegExp(IP); test()方法测试 IP是否合法., true为合法,false为不合法. document.wri...原创 2018-10-16 16:03:31 · 18794 阅读 · 0 评论